//确定
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                string tname = this.txtTemplateName.Text.Trim();
                if (tname != "")
                {
                    string sql = "update t_follow_tempplate set tname='" + tname + "' where tid='" + current_id + "'";
                    int    num = App.ExecuteSQL(sql);
                    if (num > 0)
                    {
                        App.Msg("更新成功!");

                        //对模板界面设置

                        ucFollowTemplateManagement temp = (ucFollowTemplateManagement)templateManage;
                        temp.trvModel.SelectedNode.Text = tname;
                    }
                    else
                    {
                        App.Msg("更新失败!");
                    }
                    this.Close();
                }
                else
                {
                    App.Msg("模板名称不能为空!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            TreeNode parentNode;

            ucFollowTemplateManagement temp = (ucFollowTemplateManagement)templateManage;

            parentNode = temp.trvModel.SelectedNode;


            ArrayList Sqls = new ArrayList();

            Sqls.Add("delete from t_follow_tempplate_section where TEMPLATE_ID=" + current_id + "");

            for (int i = 0; i < dataGridViewX1.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell sc = dataGridViewX1["科室", i] as DataGridViewCheckBoxCell;
                if (sc.Value != null)
                {
                    if (sc.Value.ToString() == "true")
                    {
                        DataGridViewCheckBoxCell sc2 = dataGridViewX1["默认科室", i] as DataGridViewCheckBoxCell;
                        if (sc2.Value != null)
                        {
                            if (sc2.Value.ToString() == "true")
                            {
                                ucFollowTemplateManagement.isSecDefault = "true";
                                Sqls.Add("update t_follow_tempplate_section set ISDEFAULT='N' where template_id in (select tid from t_follow_tempplate where text_type=" + text_kind + " and tempplate_level='S') and section_id=" + dataGridViewX1["科室主键", i].Value.ToString() + "");
                                Sqls.Add("insert into t_follow_tempplate_section(TEMPLATE_ID,SECTION_ID,ISDEFAULT)values(" + current_id + "," + dataGridViewX1["科室主键", i].Value.ToString() + ",'Y')");
                                Sqls.Add("update t_follow_tempplate set TEMPPLATE_LEVEL='S', ISDEFAULT='Y' where TID=" + current_id + "");
                            }
                            else
                            {
                                Sqls.Add("insert into t_follow_tempplate_section(TEMPLATE_ID,SECTION_ID,ISDEFAULT)values(" + current_id + "," + dataGridViewX1["科室主键", i].Value.ToString() + ",'N')");
                            }
                        }
                        else
                        {
                            Sqls.Add("insert into t_follow_tempplate_section(TEMPLATE_ID,SECTION_ID,ISDEFAULT)values(" + current_id + "," + dataGridViewX1["科室主键", i].Value.ToString() + ",'N')");
                        }
                    }
                }
            }
            if (ucFollowTemplateManagement.isSecDefault == "false")
            {
                Sqls.Add("update t_follow_tempplate set ISDEFAULT='N' where tid=" + current_id + "");
            }
            string[] strSqls = new string[Sqls.Count];
            for (int i = 0; i < Sqls.Count; i++)
            {
                strSqls[i] = Sqls[i].ToString();
            }
            if (App.ExecuteBatch(strSqls) > 0)
            {
                ucFollowTemplateManagement.Temp_Sections = App.GetDataSet("select * from T_FOLLOW_TEMPPLATE_SECTION");
                App.Msg("设置成功!");
            }

            this.Close();
        }