protected void btnSave_Click(object sender, EventArgs p1) { //alert(10) if (Id > 0) { #region __________Edit__________ model = bll.GetModel(Id); model.C_SubTitle = txtC_Title.Text; model.N_Type = Utils.StrToInt(drpType.SelectedValue, 0); model.N_SysId = Utils.StrToInt(hidSysvoteid.Value, 0); if (bll.Update(model)) { MessageBox.JSLoad(this, "alert('保存成功!');window.location.href='voteunit.aspx?sysid=" + sysid + "'"); } #endregion } else { #region __________Add__________ model.C_SubTitle = txtC_Title.Text; model.N_Type = Utils.StrToInt(drpType.SelectedValue, 0); model.N_SysId = Utils.StrToInt(hidSysvoteid.Value, 0); if (bll.Add(model)) { if (model.N_Type == 1 || model.N_Type == 5) { var mk = new MW.Model.M_Mw_votekey(); mk.N_SubId = bll.GetMaxId(); mk.C_KeyTitle = ""; mk.N_Type = model.N_Type; mk.N_OrderId = 0; mk.C_Rule = "不限制`"; mk.N_Score = 0; mk.C_LogicSub = ""; new MW.BLL.B_Votekey().Add(mk); } MessageBox.JSLoad(this, "alert('保存成功!');window.location.href='voteunit.aspx?sysid=" + sysid + "'"); } #endregion } }
protected void btnSave_Click(object sender, EventArgs p1) { string C_Rule = DDLRule.SelectedItem.Text + "`" + DDLRule.SelectedItem.Value.Replace("&", "&").Replace("<", "<").Replace(">", ">"); if (Id > 0) { #region __________Edit__________ model = bll.GetModel(Id); model.N_SubId = int.Parse(hidsubid.Value); model.C_KeyTitle = txtC_KeyTitle.Text; model.N_Type = int.Parse(hidtype.Value); model.N_OrderId = int.Parse(txtN_OrderId.Text); model.C_Rule = C_Rule; model.N_Score = int.Parse(txtN_Score.Text); model.C_LogicSub = ""; if (bll.Update(model)) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Edit, "", ""); MessageBox.JSLoad(this, "alert('保存成功!');window.location.href='makeitem.aspx?sysid=" + sysid + "&type=" + hidtype.Value + "&subid=" + hidsubid.Value + "'"); } #endregion } else { #region __________Add__________ model.N_SubId = int.Parse(hidsubid.Value); model.C_KeyTitle = txtC_KeyTitle.Text; model.N_Type = int.Parse(hidtype.Value); model.N_OrderId = int.Parse(txtN_OrderId.Text); model.C_Rule = C_Rule; model.N_Score = int.Parse(txtN_Score.Text); model.C_LogicSub = ""; if (bll.Add(model)) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Add, "", ""); MessageBox.JSLoad(this, "alert('保存成功!');window.location.href='makeitem.aspx?sysid=" + sysid + "&type=" + hidtype.Value + "&subid=" + hidsubid.Value + "'"); } #endregion } }
private void InitData() { hidsubid.Value = subid.ToString(); hidtype.Value = ntype.ToString(); if (Id > 0) {//edit model = bll.GetModel(Id); if (model != null) { txtC_KeyTitle.Text = model.C_KeyTitle; drpType.SelectedValue = model.N_Type.ToString(); txtN_OrderId.Text = model.N_OrderId.ToString(); DDLRule.SelectedItem.Text = model.C_Rule.Split('`')[0]; txtN_Score.Text = model.N_Score.ToString(); if (BaseVote.ShowSysEdit(sysid)) { txtC_KeyTitle.Enabled = false; drpType.Enabled = false; txtN_Score.Enabled = false; } } } }