private void btnCreateValue_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.txtAddCmpName.Text.Trim())) { this.ShowMsg("物流名称不允许为空!", false); } else { if (string.IsNullOrEmpty(this.txtAddKuaidi100Code.Text.Trim())) { this.ShowMsg("快递100Code不允许为空!", false); } else { if (string.IsNullOrEmpty(this.txtAddTaobaoCode.Text.Trim())) { this.ShowMsg("淘宝Code不允许为空!", false); } else { if (!string.IsNullOrEmpty(this.hdcomputers.Value.Trim())) { ExpressHelper.UpdateExpress(Globals.HtmlEncode(this.hdcomputers.Value.Trim()), Globals.HtmlEncode(this.txtAddCmpName.Text.Trim()), Globals.HtmlEncode(this.txtAddKuaidi100Code.Text.Trim()), Globals.HtmlEncode(this.txtAddTaobaoCode.Text.Trim())); this.ShowMsg("修改物流公司信息成功!", true); } else { if (ExpressHelper.IsExitExpress(this.txtAddCmpName.Text.Trim())) { this.ShowMsg("此物流公司已存在,请重新输入!", false); return; } ExpressHelper.AddExpress(Globals.HtmlEncode(this.txtAddCmpName.Text.Trim()), Globals.HtmlEncode(this.txtAddKuaidi100Code.Text.Trim()), Globals.HtmlEncode(this.txtAddTaobaoCode.Text.Trim())); this.ShowMsg("添加物流公司信息成功!", true); } this.LoadDataSource(); this.txtAddCmpName.Text = ""; this.txtAddKuaidi100Code.Text = ""; this.txtAddTaobaoCode.Text = ""; this.hdcomputers.Value = ""; } } } }
private void AddAndUpdate(HttpContext context) { string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; text = base.GetParameter(context, "companyname", false); text2 = base.GetParameter(context, "kuaidi100Code", false); text3 = base.GetParameter(context, "taobaoCode", false); text4 = base.GetParameter(context, "jdCode", false); if (string.IsNullOrEmpty(text.Trim())) { throw new HidistroAshxException("物流名称不允许为空!"); } if (string.IsNullOrEmpty(text2.Trim())) { throw new HidistroAshxException("快递鸟Code不允许为空!"); } if (string.IsNullOrEmpty(text3.Trim())) { throw new HidistroAshxException("淘宝Code不允许为空!"); } if (string.IsNullOrEmpty(text4.Trim())) { throw new HidistroAshxException("京东Code不允许为空!"); } string parameter = base.GetParameter(context, "hdcomputers", false); if (!string.IsNullOrEmpty(parameter.Trim())) { ExpressHelper.UpdateExpress(Globals.HtmlEncode(parameter), Globals.HtmlEncode(text.Trim()), Globals.HtmlEncode(text2.Trim()), Globals.HtmlEncode(text3.Trim()), Globals.HtmlEncode(text4.Trim())); base.ReturnSuccessResult(context, "修改物流公司信息成功!", 0, true); } else if (ExpressHelper.IsExitExpress(text.Trim())) { throw new HidistroAshxException("此物流公司已存在,请重新输入!"); } ExpressHelper.AddExpress(Globals.HtmlEncode(text.Trim()), Globals.HtmlEncode(text2.Trim()), Globals.HtmlEncode(text3.Trim()), Globals.HtmlEncode(text4.Trim())); base.ReturnSuccessResult(context, "添加物流公司信息成功!", 0, true); }