private void AddDep() { int iNumber = Convert.ToInt32(this.txtNo.Text.Trim()); string strDeptName = this.txtName.Text.Trim(); DeptManageDb deptManageDb = new DeptManageDb(); bool flag = deptManageDb.AddDepart(strDeptName, iNumber, this.sjdm, ""); if (flag) { //int depID = Convert.ToInt32(publicDbOpClass.QuaryMaxid("pt_d_bm", "i_bmdm")); //DataTable dt = publicDbOpClass.DataTableQuary("select * from PT_d_bm where i_bmdm = " + depID); //if (dt.Rows.Count > 0) //{ // foreach (DataRow dataRow in dt.Rows) // { // try // { // string strResult = WXAPI.createWXdpt(dt.Rows[0]); // if (strResult == "0") // { base.RegisterScript("addSucessed();"); // } // else // { // base.RegisterScript("top.ui.show( '添加成功,同步到微信失败'); \n top.ui.closeWin(); \n"); // } // } // catch // { // base.RegisterScript("top.ui.show( '添加成功'); \n top.ui.closeWin(); \n"); // } // } //} //else //{ // base.RegisterScript("top.ui.show( '添加成功,同步到微信失败'); \n top.ui.closeWin(); \n"); //} } else { base.RegisterScript("top.ui.show( '添加失败'); \n top.ui.closeWin(); \n"); } }
protected void BtnAdd_Click(object sender, EventArgs e) { object obj = new object(); int iUpDeptCode = Convert.ToInt32(this.HdnDeptCode.Value.ToString()); string text = this.TBoxDeptName.Text.ToString().Trim(); string strBMBM = this.ddl.SelectedValue.ToString(); if (!Information.IsNumeric(this.TBoxNumber.Text.ToString().Trim()) || this.TBoxNumber.Text.ToString().Trim().Contains(".")) { this.WarnBlock.InnerHtml = "<SCRIPT language=\"JavaScript\">alert('序号必须为数字!');</SCRIPT>"; return; } if (Convert.ToInt32(this.TBoxNumber.Text.ToString().Trim()) < 0) { this.WarnBlock.InnerHtml = "<SCRIPT language=\"JavaScript\">alert('序号必须为自然数!');</SCRIPT>"; return; } int iNumber = Convert.ToInt32(this.TBoxNumber.Text.ToString().Trim()); if (text.Length == 0) { this.WarnBlock.InnerHtml = "<SCRIPT language=\"JavaScript\">alert('部门名称不能为空!');</SCRIPT>"; return; } DeptManageDb deptManageDb = new DeptManageDb(); deptManageDb.ObjPage = this.Page; lock (obj) { if (deptManageDb.AddDepart(text, iNumber, iUpDeptCode, strBMBM)) { this.PanNewDept.Visible = false; this.hfldbtnadd.Value = "0"; this.DGrdSubDept_DataBind(); } else { this.WarnBlock.InnerHtml = "<SCRIPT language=\"JavaScript\">alert('" + deptManageDb.MessageString + "');</SCRIPT>"; } } }