Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Com.Session.userid == null)
     {
         Response.Redirect("../../Login.aspx");
         Response.End();
     }
     else
     {
         SchSystem.BLL.ServBusThd   servbusbll   = new SchSystem.BLL.ServBusThd();
         SchSystem.Model.ServBusThd servbusmodel = new SchSystem.Model.ServBusThd();
         BusId        = Request.Params["BusId"].ToString();
         servbusmodel = servbusbll.GetModel(int.Parse(BusId));
         string FuncStr = "";
         if (servbusmodel != null && servbusmodel.BusId > 0)
         {
             umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(servbusmodel);
         }
         else
         {
             Response.Write("无该套餐!");
             Response.End();
         }
         //获取下拉列表
         StringBuilder sbarea = new StringBuilder();
         //获取省份
         sbarea.Append(" <div class=\"row\">");
         sbarea.Append("<div class=\"col-xs-3 text-right\">默认归属地(省):</div>");
         sbarea.Append("<div class=\"col-xs-2 text-left\">");
         sbarea.Append("<select id=\"aprov\">");
         string sareacode = "";
         if (servbusmodel != null && servbusmodel.BusId > 0 && servbusmodel.BusArea.Length == 6)
         {
             sareacode = servbusmodel.BusArea.Substring(0, 2) + "0000";
         }
         sbarea.Append(Com.Public.GetDrpArea("0", "", ref sareacode, false, "0"));
         sbarea.Append("</select> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;");
         sbarea.Append(" </div>");
         //获取城市
         sbarea.Append("<div class=\"col-xs-3 text-right\">默认归属地(市):</div>");
         sbarea.Append("<div class=\"col-xs-3 text-left\">");
         sbarea.Append("<select id=\"acity\">");
         string sareacitycode = "";
         if (servbusmodel != null && servbusmodel.BusId > 0 && servbusmodel.BusArea.Length == 6)
         {
             sareacitycode = servbusmodel.BusArea.Substring(0, 4) + "00";
         }
         sbarea.Append(Com.Public.GetDrpArea("1", sareacode, ref sareacitycode, false, "0"));
         sbarea.Append("</select> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;");
         sbarea.Append(" </div>");
         sbarea.Append(" </div>");
         areastr = sbarea.ToString();
         //对应套餐
         SchSystem.BLL.ServBus stBll = new SchSystem.BLL.ServBus();
         DataTable             stdt  = stBll.GetList("BusId,CnName", "").Tables[0];
         servbus = Newtonsoft.Json.JsonConvert.SerializeObject(stdt);
     }
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SchSystem.Model.ServBusThd model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ServBusThd(");
            strSql.Append("ThdName,ServiceId,FeeCode,CnName,BusMonth,BusNote,BusArea,BusUtype,Mbusid,BusType,BusUrl,Note,ThdMonth)");
            strSql.Append(" values (");
            strSql.Append("@ThdName,@ServiceId,@FeeCode,@CnName,@BusMonth,@BusNote,@BusArea,@BusUtype,@Mbusid,@BusType,@BusUrl,@Note,@ThdMonth)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ThdName",   SqlDbType.NVarChar,  50),
                new SqlParameter("@ServiceId", SqlDbType.VarChar,   20),
                new SqlParameter("@FeeCode",   SqlDbType.VarChar,   10),
                new SqlParameter("@CnName",    SqlDbType.VarChar,   30),
                new SqlParameter("@BusMonth",  SqlDbType.Int,        4),
                new SqlParameter("@BusNote",   SqlDbType.NVarChar, 300),
                new SqlParameter("@BusArea",   SqlDbType.VarChar,   10),
                new SqlParameter("@BusUtype",  SqlDbType.TinyInt,    1),
                new SqlParameter("@Mbusid",    SqlDbType.Int,        4),
                new SqlParameter("@BusType",   SqlDbType.TinyInt,    1),
                new SqlParameter("@BusUrl",    SqlDbType.VarChar,  300),
                new SqlParameter("@Note",      SqlDbType.VarChar,  100),
                new SqlParameter("@ThdMonth",  SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.ThdName;
            parameters[1].Value  = model.ServiceId;
            parameters[2].Value  = model.FeeCode;
            parameters[3].Value  = model.CnName;
            parameters[4].Value  = model.BusMonth;
            parameters[5].Value  = model.BusNote;
            parameters[6].Value  = model.BusArea;
            parameters[7].Value  = model.BusUtype;
            parameters[8].Value  = model.Mbusid;
            parameters[9].Value  = model.BusType;
            parameters[10].Value = model.BusUrl;
            parameters[11].Value = model.Note;
            parameters[12].Value = model.ThdMonth;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SchSystem.Model.ServBusThd GetModel(int BusId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 BusId,ThdName,ServiceId,FeeCode,CnName,BusMonth,BusNote,BusArea,BusUtype,Mbusid,BusType,BusUrl,Note,ThdMonth from ServBusThd ");
            strSql.Append(" where BusId=@BusId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BusId", SqlDbType.Int, 4)
            };
            parameters[0].Value = BusId;

            SchSystem.Model.ServBusThd model = new SchSystem.Model.ServBusThd();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 public static Com.DataPack.DataRsp <string> ServBusEditSave(List <string> arr)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "你现在登录已过期,请重新登录!";
     }
     else
     {
         string currentCnName = ""; string currentCode = "";
         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] == "BusId")
                 {
                     servbusmodel.BusId = Convert.ToInt32(strarr[1]);
                 }
                 else 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();
                 }
                 else if (strarr[0] == "currentCnName")
                 {
                     currentCnName = strarr[1].Trim();
                 }
                 else if (strarr[0] == "currentCode")
                 {
                     currentCode = strarr[1].Trim();
                 }
             }
             DataTable cnnamedt = servbusbll.ExistsCnNameUpdate(servbusmodel.CnName, 0, currentCnName).Tables[0];
             DataTable codedt   = servbusbll.ExistsCodeUpdate(servbusmodel.ServiceId, 0, currentCode).Tables[0];
             if (servbusmodel.ThdName == "" || servbusmodel.CnName == "")
             {
                 rsp.code = "error";
                 rsp.msg  = "操作失败!不允许输入空格";
             }
             else if (cnnamedt.Rows.Count > 0)
             {
                 rsp.code = "nameRepeat";
                 rsp.msg  = "套餐名称不允许重复";
             }
             else if (codedt.Rows.Count > 0)
             {
                 rsp.code = "codeRepeat";
                 rsp.msg  = "套餐代码不允许重复";
             }
             else
             {
                 if (servbusbll.Update(servbusmodel))
                 {
                     rsp.code = "success";
                     rsp.msg  = "操作成功";
                 }
                 else
                 {
                     rsp.code = "error";
                     rsp.msg  = "操作失败";
                 }
             }
         }
         catch (Exception ex)
         {
             rsp.code = "excepError";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
 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);
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SchSystem.Model.ServBusThd DataRowToModel(DataRow row)
 {
     SchSystem.Model.ServBusThd model = new SchSystem.Model.ServBusThd();
     if (row != null)
     {
         if (row["BusId"] != null && row["BusId"].ToString() != "")
         {
             model.BusId = int.Parse(row["BusId"].ToString());
         }
         if (row["ThdName"] != null)
         {
             model.ThdName = row["ThdName"].ToString();
         }
         if (row["ServiceId"] != null)
         {
             model.ServiceId = row["ServiceId"].ToString();
         }
         if (row["FeeCode"] != null)
         {
             model.FeeCode = row["FeeCode"].ToString();
         }
         if (row["CnName"] != null)
         {
             model.CnName = row["CnName"].ToString();
         }
         if (row["BusMonth"] != null && row["BusMonth"].ToString() != "")
         {
             model.BusMonth = int.Parse(row["BusMonth"].ToString());
         }
         if (row["BusNote"] != null)
         {
             model.BusNote = row["BusNote"].ToString();
         }
         if (row["BusArea"] != null)
         {
             model.BusArea = row["BusArea"].ToString();
         }
         if (row["BusUtype"] != null && row["BusUtype"].ToString() != "")
         {
             model.BusUtype = int.Parse(row["BusUtype"].ToString());
         }
         if (row["Mbusid"] != null && row["Mbusid"].ToString() != "")
         {
             model.Mbusid = int.Parse(row["Mbusid"].ToString());
         }
         if (row["BusType"] != null && row["BusType"].ToString() != "")
         {
             model.BusType = int.Parse(row["BusType"].ToString());
         }
         if (row["BusUrl"] != null)
         {
             model.BusUrl = row["BusUrl"].ToString();
         }
         if (row["Note"] != null)
         {
             model.Note = row["Note"].ToString();
         }
         if (row["ThdMonth"] != null && row["ThdMonth"].ToString() != "")
         {
             model.ThdMonth = int.Parse(row["ThdMonth"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SchSystem.Model.ServBusThd model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ServBusThd set ");
            strSql.Append("ThdName=@ThdName,");
            strSql.Append("ServiceId=@ServiceId,");
            strSql.Append("FeeCode=@FeeCode,");
            strSql.Append("CnName=@CnName,");
            strSql.Append("BusMonth=@BusMonth,");
            strSql.Append("BusNote=@BusNote,");
            strSql.Append("BusArea=@BusArea,");
            strSql.Append("BusUtype=@BusUtype,");
            strSql.Append("Mbusid=@Mbusid,");
            strSql.Append("BusType=@BusType,");
            strSql.Append("BusUrl=@BusUrl,");
            strSql.Append("Note=@Note,");
            strSql.Append("ThdMonth=@ThdMonth");
            strSql.Append(" where BusId=@BusId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ThdName",   SqlDbType.NVarChar,  50),
                new SqlParameter("@ServiceId", SqlDbType.VarChar,   20),
                new SqlParameter("@FeeCode",   SqlDbType.VarChar,   10),
                new SqlParameter("@CnName",    SqlDbType.VarChar,   30),
                new SqlParameter("@BusMonth",  SqlDbType.Int,        4),
                new SqlParameter("@BusNote",   SqlDbType.NVarChar, 300),
                new SqlParameter("@BusArea",   SqlDbType.VarChar,   10),
                new SqlParameter("@BusUtype",  SqlDbType.TinyInt,    1),
                new SqlParameter("@Mbusid",    SqlDbType.Int,        4),
                new SqlParameter("@BusType",   SqlDbType.TinyInt,    1),
                new SqlParameter("@BusUrl",    SqlDbType.VarChar,  300),
                new SqlParameter("@Note",      SqlDbType.VarChar,  100),
                new SqlParameter("@ThdMonth",  SqlDbType.Int,        4),
                new SqlParameter("@BusId",     SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.ThdName;
            parameters[1].Value  = model.ServiceId;
            parameters[2].Value  = model.FeeCode;
            parameters[3].Value  = model.CnName;
            parameters[4].Value  = model.BusMonth;
            parameters[5].Value  = model.BusNote;
            parameters[6].Value  = model.BusArea;
            parameters[7].Value  = model.BusUtype;
            parameters[8].Value  = model.Mbusid;
            parameters[9].Value  = model.BusType;
            parameters[10].Value = model.BusUrl;
            parameters[11].Value = model.Note;
            parameters[12].Value = model.ThdMonth;
            parameters[13].Value = model.BusId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }