public static string ServBusThdAddSave(List <string> arr) { string ret = ""; if (Com.Session.userid == null) { ret = "expire"; } else { SchSystem.BLL.ServBusThd servbusbll = new SchSystem.BLL.ServBusThd(); SchSystem.Model.ServBusThd servbusmodel = new SchSystem.Model.ServBusThd(); foreach (string str in arr) { string[] strarr = str.Split('#'); if (strarr[0] == "ThdName") { servbusmodel.ThdName = strarr[1]; } if (strarr[0] == "ServiceId") { servbusmodel.ServiceId = strarr[1]; } if (strarr[0] == "CnName") { servbusmodel.CnName = strarr[1]; } if (strarr[0] == "FeeCode") { servbusmodel.FeeCode = strarr[1]; } if (strarr[0] == "BusMonth") { servbusmodel.BusMonth = Convert.ToInt32(strarr[1]); } if (strarr[0] == "BusNote") { servbusmodel.BusNote = strarr[1]; } if (strarr[0] == "BusArea") { servbusmodel.BusArea = strarr[1]; } if (strarr[0] == "BusUtype") { servbusmodel.BusUtype = Convert.ToInt32(strarr[1]); } if (strarr[0] == "Mbusid") { servbusmodel.Mbusid = Convert.ToInt32(strarr[1]); } if (strarr[0] == "ThdMonth") { servbusmodel.ThdMonth = Convert.ToInt32(strarr[1]); } if (strarr[0] == "Note") { servbusmodel.Note = strarr[1]; } } try { int result = servbusbll.Add(servbusmodel); if (result > 0) { ret = "success"; } else { ret = "error"; } } catch (Exception ex) { ret = ex.Message; } } return(ret); }
public static Com.DataPack.DataRsp <string> ServBusThdAddSave(List <string> arr) { Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>(); if (Com.Session.userid == null) { rsp.code = "expire"; rsp.msg = "你现在登录已过期,请重新登录!"; } else { try { SchSystem.BLL.ServBusThd servbusbll = new SchSystem.BLL.ServBusThd(); SchSystem.Model.ServBusThd servbusmodel = new SchSystem.Model.ServBusThd(); foreach (string str in arr) { string[] strarr = str.Split('#'); if (strarr[0] == "ThdName") { servbusmodel.ThdName = strarr[1].Trim(); } else if (strarr[0] == "ServiceId") { servbusmodel.ServiceId = strarr[1].Trim(); } else if (strarr[0] == "CnName") { servbusmodel.CnName = strarr[1].Trim(); } else if (strarr[0] == "FeeCode") { servbusmodel.FeeCode = strarr[1].Trim(); } else if (strarr[0] == "BusMonth") { servbusmodel.BusMonth = Convert.ToInt32(strarr[1]); } else if (strarr[0] == "BusNote") { servbusmodel.BusNote = strarr[1].Trim(); } else if (strarr[0] == "BusArea") { servbusmodel.BusArea = strarr[1].Trim(); } else if (strarr[0] == "BusUtype") { servbusmodel.BusUtype = Convert.ToInt32(strarr[1]); } else if (strarr[0] == "Mbusid") { servbusmodel.Mbusid = Convert.ToInt32(strarr[1]); } else if (strarr[0] == "ThdMonth") { servbusmodel.ThdMonth = Convert.ToInt32(strarr[1]); } else if (strarr[0] == "Note") { servbusmodel.Note = strarr[1].Trim(); } } if (servbusmodel.ThdName == "" || servbusmodel.CnName == "") { rsp.code = "error"; rsp.msg = "操作失败!不允许输入空格"; } else if (servbusbll.ExistsServiceId(0, servbusmodel.ServiceId)) { rsp.code = "code"; rsp.msg = "套餐代码不允许重复!"; } else if (servbusbll.ExistsCnName(0, servbusmodel.CnName)) { rsp.code = "zhcf"; rsp.msg = "套餐名称不允许重复!"; } else { int result = servbusbll.Add(servbusmodel); if (result > 0) { rsp.code = "success"; rsp.msg = "操作成功"; } else { rsp.code = "error"; rsp.msg = "操作失败"; } } } catch (Exception ex) { rsp.code = "ExcepError"; rsp.msg = ex.Message; } } return(rsp); }