VS2005winform程序中获取用户控件的值

来源:互联网 发布:微信公众平台网页源码 编辑:程序博客网 时间:2024/05/29 07:35
//在用户控件中定义public变量和属性,这样在调用窗体中就可以方便的使用用户控件的值
                foreach (Control ctr in panel_fill.Controls)
                {
                    UserControl_TJ_ResultsEntry uctre = null;//用户控件
                    if (ctr.GetType() == typeof(UserControl_TJ_ResultsEntry))
                    {
                        uctre = ctr as UserControl_TJ_ResultsEntry;
                        int i_all = 0;
                        for (int j = 0; j < uctre.itemchange_group_dt.Rows.Count; j++)
                        {                            
                            DataRow item_row = uctre.itemchange_group_dt.Rows[j];//用户控件中定义的public表
                            string str_state = item_row["State"] == null ? "" : item_row["State"].ToString();
                            if (str_state == "已检")
                                i_all++;
                            bll_itemresult.UpdateResultByGUID(item_row["GUID"].ToString(), item_row["Result"].ToString(), str_state);                            
                        }
                        //根据体检id和组合id更新组合检验状态0,1,2,3
                        if (i_all == uctre.itemchange_group_dt.Rows.Count)
                            bll_itemgroup.UpdateGroupByTIDandGID(this.Current_TJ_ID, uctre.itemchange_group_dt.Rows[0]["GroupID"].ToString(), "3", Convert.ToDateTime(uctre.GROUP_TJ_TIME), uctre.GROUP_DOCTORID, uctre.GROUP_DOCTORNAME);//GROUP_DOCTORID,GROUP_DOCTORNAME用户控件中定义的属性
                        else if (i_all > 0 && i_all < uctre.itemchange_group_dt.Rows.Count)
                            bll_itemgroup.UpdateGroupByTIDandGID(this.Current_TJ_ID, uctre.itemchange_group_dt.Rows[0]["GroupID"].ToString(), "2", Convert.ToDateTime(uctre.GROUP_TJ_TIME), uctre.GROUP_DOCTORID, uctre.GROUP_DOCTORNAME);
                        else
                            bll_itemgroup.UpdateGroupByTIDandGID(this.Current_TJ_ID, uctre.itemchange_group_dt.Rows[0]["GroupID"].ToString(), "1", Convert.ToDateTime(uctre.GROUP_TJ_TIME), uctre.GROUP_DOCTORID, uctre.GROUP_DOCTORNAME);
                    }
                }
0 0
原创粉丝点击