protected void btnSavesecondrec_Click(object sender, EventArgs e) { string strID = textSavesecondrec.Text.Trim(); string str1 = secondrecWineditID.Text; int intresult = 0; if (secondrecmpci.SelectedValueArray.Length > 0) { string select = String.Join(", ", secondrecmpci.SelectedValueArray); pd_kidclass_secondrec secrec = new pd_kidclass_secondrec(); pd_kidclass_mainmpic pic = new pd_kidclass_mainmpic(); foreach (var sel in select.Split(',')) { string mpciID = pic.getCodedata(strID, sel.Trim()); Dictionary <string, string> dic1 = initDatadicsesecondrec(str1, mpciID); dic1.Add("ID", Guid.NewGuid().ToString()); secrec.add(dic1, "pd_kidclass_secondrec"); } intresult = 1; } if (CurPage1.Text.Trim() == "") { setPageContent1(1); } else { setPageContent1(5); } Alert alert = new Alert(); if (intresult == 1) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据保存失败"; } alert.Show(); }
protected void btnSave_Click(object sender, EventArgs e) { string strID = editID.Text.ToString().Trim(); int intresult = 0; if (strID == "systemmenu") { Dictionary <string, string> dic = initDatadicmain(mainname.Text.Trim(), orderint.Text.Trim(), code.Text.Trim()); pd_kidclass_main ul = new pd_kidclass_main(); dic.Add("ID", Guid.NewGuid().ToString()); string strmainname = dic["mainname"].ToString().Trim(); string strmaincode = dic["maincode"].ToString().Trim(); if (ul.isExistdata("pd_kidclass_main", "mainname", strmainname, "mainname").Trim() != "") { Alert.Show(strmainname + " 类别名称已经存在!"); return; } else if (ul.isExistdata("pd_kidclass_main", "maincode", strmaincode, "maincode").Trim() != "") { Alert.Show(strmaincode + " 编码已经存在!"); return; } else { intresult = ul.add(dic, "pd_kidclass_main"); string strmpic = mpci.Text.Trim(); if (strmpic != null && strmpic != "") { foreach (var str in strmpic.Split(',')) { Dictionary <string, string> dic1 = initDatadicmainmpic(str, dic["ID"].ToString().Trim(), ""); dic1.Add("ID", Guid.NewGuid().ToString()); ul.add(dic1, "pd_kidclass_mainmpic"); } } } } else { Dictionary <string, string> dic = initDatadicsecond(mainname.Text.Trim(), strID, orderint.Text.Trim(), code.Text.Trim()); pd_kidclass_secondary ul = new pd_kidclass_secondary(); dic.Add("ID", Guid.NewGuid().ToString()); string strmainname = dic["classname"].ToString().Trim(); string strdarycode = dic["darycode"].ToString().Trim(); DataTable dt = ul.getEditdatabyID(strID, strmainname); if (dt != null && dt.Rows.Count > 0) { Alert.Show(strmainname + " 类别名称已经存在!"); return; } else if (ul.isExistdata("pd_kidclass_secondary", "darycode", strdarycode, "darycode").Trim() != "") { Alert.Show(strdarycode + " 编码已经存在!"); return; } else { intresult = ul.add(dic, "pd_kidclass_secondary"); if (dartmpci.SelectedValueArray.Length > 0) { string select = String.Join(", ", dartmpci.SelectedValueArray); pd_kidclass_secondrec secrec = new pd_kidclass_secondrec(); pd_kidclass_mainmpic pic = new pd_kidclass_mainmpic(); foreach (var sel in select.Split(',')) { string mpciID = pic.getCodedata(strID, sel.Trim()); Dictionary <string, string> dic1 = initDatadicsesecondrec(dic["ID"], mpciID); dic1.Add("ID", Guid.NewGuid().ToString()); secrec.add(dic1, "pd_kidclass_secondrec"); } } } } Alert alert = new Alert(); if (intresult == 1) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; PageContext.RegisterStartupScript("preview();"); } alert.Show(); }