Exemple #1
0
 /// <summary>
 /// 新增客户类型
 /// </summary>
 /// <param name="customerType"></param>
 /// <returns>新增是否成功</returns>
 public bool AddCustomerType(CustomerType customerType)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Insert<CustomerType>(customerType);
         return true;
     }
 }
Exemple #2
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Ajax.Model.CustomerType> DataTableToList(DataTable dt)
 {
     List<Ajax.Model.CustomerType> modelList = new List<Ajax.Model.CustomerType>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Ajax.Model.CustomerType model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Ajax.Model.CustomerType();
             if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
             {
                 model.ID = dt.Rows[n]["ID"].ToString();
             }
             if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
             {
                 model.Name = dt.Rows[n]["Name"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemple #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Ajax.Model.CustomerType> DataTableToList(DataTable dt)
        {
            List <Ajax.Model.CustomerType> modelList = new List <Ajax.Model.CustomerType>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Ajax.Model.CustomerType model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Ajax.Model.CustomerType();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = dt.Rows[n]["ID"].ToString();
                    }
                    if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[n]["Name"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
 public ActionResult AddCustomerType(CustomerType customerType)
 {
     AjaxResult result = new AjaxResult();
     customerType.ID = Guid.NewGuid().ToString().Replace("-", "");
     try
     {
         if (new CustomerTypeRule().AddCustomerType(customerType))
         {
             result.Success = true;
             result.Message = "客户类型新增成功。";
         }
         else
         {
             result.Success = false;
             result.Message = "客户类型新增失败。";
         }
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.Message = "新增失败:" + ex.Message;
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Exemple #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Ajax.Model.CustomerType model)
 {
     return(dal.Update(model));
 }
Exemple #6
0
 /// <summary>
 /// 新增客户类型
 /// </summary>
 /// <param name="customerTYpe"></param>
 /// <returns></returns>
 public bool AddCustomerType(CustomerType customerTYpe)
 {
     return dal.AddCustomerType(customerTYpe);
 }
Exemple #7
0
 /// <summary>
 /// 更新客户类型
 /// </summary>
 /// <param name="customerType"></param>
 /// <returns></returns>
 public bool UpdateCustomerType(CustomerType customerType)
 {
     return dal.UpdateCustomerType(customerType);
 }
Exemple #8
0
 //(JQueryDataTableParamModel param, string orderType, string sortingCols)
 /// <summary>
 /// 获取所有的客户类型
 /// </summary>
 /// <param name="param"></param>
 /// <param name="orderType"></param>
 /// <param name="sortingCols"></param>
 /// <returns></returns>
 public List<dynamic> GetAllCustomerType(EasyUIGridParamModel param, CustomerType cType, out int itemCount)
 {
     return dal.GetAllCustomerType(param, cType, out itemCount);
 }
Exemple #9
0
        /// <summary>
        /// 获取所有客户类型
        /// </summary>
        /// <param name="param"></param>
        /// <param name="cType"></param>
        /// <param name="itemCount"></param>
        /// <returns></returns>
        public List<dynamic> GetAllCustomerType(EasyUIGridParamModel param, CustomerType cType, out int itemCount)
        {
            List<SqlParameter> paramList = new List<SqlParameter>();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,name from t_customerType ");
            strSql.Append("where 1=1 ");
            Dictionary<string, object> paramDic = new Dictionary<string, object>();

            if (!string.IsNullOrEmpty(cType.Name))
            {
                strSql.Append("and name like @name ");
                paramDic.Add("name", string.Format("%{0}%", cType.Name));
            }
            int pageIndex = Convert.ToInt32(param.page) - 1;
            int pageSize = Convert.ToInt32(param.rows);
            using (DBHelper db = DBHelper.Create())
            {
                itemCount = db.GetListCount(strSql.ToString(), paramDic);
                return db.GetDynaminObjectList(strSql.ToString(), pageIndex, pageSize, "name", paramDic);
            }
        }
Exemple #10
0
 /// <summary>
 /// 更新客户类型
 /// </summary>
 /// <param name="customerType"></param>
 /// <returns>更新是否成功</returns>
 public bool UpdateCustomerType(CustomerType customerType)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Update<CustomerType>(customerType);
         return true;
     }
 }
Exemple #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CustomerType model)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Update<CustomerType>(model);
         return true;
     }
 }
Exemple #12
0
 public ActionResult GetAllCustomerType(EasyUIGridParamModel param, CustomerType cType)
 {
     int itemCount = 0;
     List<dynamic> customerTypeList = new CustomerTypeRule().GetAllCustomerType(param, cType, out itemCount);
     var showList = from c in customerTypeList
                    select new
                    {
                        ID = Convert.ToString(c.ID),
                        NAME = c.NAME
                    };
     return Json(new { total = itemCount, rows = showList }, JsonRequestBehavior.AllowGet);
 }
Exemple #13
0
        public ActionResult UpdateCustomerType(CustomerType customerType)
        {
            AjaxResult result = new AjaxResult();
            try
            {
                if (new CustomerTypeRule().UpdateCustomerType(customerType))
                {
                    result.Success = true;
                    result.Message = "更新成功";
                }
                else
                {
                    throw new Exception("更新失败");
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;

            }
            return Json(result, JsonRequestBehavior.AllowGet);
        }