Exemplo n.º 1
0
 /// <summary>
 /// 显示详情页
 /// </summary>
 /// <param name="EditType">编辑类型</param>
 /// <returns>返回编辑结果</returns>
 public ActionResult ClientManageEdit(E_tb_ClientManage eClientManage, string EditType, int?InfoID)
 {
     ViewData["ClientLevelList"] = GetLevelList();
     ViewData["ContractImgList"] = GetContractImgList();
     if (EditType == "Edit")
     {
         eClientManage = tClientManage.GetModel(Convert.ToInt32(InfoID));
     }
     eClientManage.EditType = EditType;
     return(View(eClientManage));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <E_tb_ClientManage> DataTableToList(DataTable dt)
        {
            List <E_tb_ClientManage> modelList = new List <E_tb_ClientManage>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                E_tb_ClientManage model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new E_tb_ClientManage();
                    if (dt.Rows[n]["ClientID"].ToString() != "")
                    {
                        model.ClientID = int.Parse(dt.Rows[n]["ClientID"].ToString());
                    }
                    model.ClientName   = dt.Rows[n]["ClientName"].ToString();
                    model.Contact      = dt.Rows[n]["Contact"].ToString();
                    model.Email        = dt.Rows[n]["Email"].ToString();
                    model.Deputy       = dt.Rows[n]["Deputy"].ToString();
                    model.Address      = dt.Rows[n]["Address"].ToString();
                    model.Fixed        = dt.Rows[n]["Fixed"].ToString();
                    model.Tel          = dt.Rows[n]["Tel"].ToString();
                    model.Fax          = dt.Rows[n]["Fax"].ToString();
                    model.ZipCode      = dt.Rows[n]["ZipCode"].ToString();
                    model.ClientLevel  = dt.Rows[n]["ClientLevel"].ToString();
                    model.PrepaidMoney = dt.Rows[n]["PrepaidMoney"].ToString();
                    model.MainBusiness = dt.Rows[n]["MainBusiness"].ToString();
                    model.YearEntrust  = dt.Rows[n]["YearEntrust"].ToString();
                    model.Incentives   = dt.Rows[n]["Incentives"].ToString();
                    model.ContractNo   = dt.Rows[n]["ContractNo"].ToString();
                    if (dt.Rows[n]["ContractImgID"].ToString() != "")
                    {
                        model.ContractImgID = int.Parse(dt.Rows[n]["ContractImgID"].ToString());
                    }
                    model.ContractPath = dt.Rows[n]["ContractPath"].ToString();
                    if (dt.Rows[n]["AreaID"].ToString() != "")
                    {
                        model.AreaID = int.Parse(dt.Rows[n]["AreaID"].ToString());
                    }
                    if (dt.Rows[n]["EditPersonnelID"].ToString() != "")
                    {
                        model.EditPersonnelID = int.Parse(dt.Rows[n]["EditPersonnelID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存信息
        /// 作者:小朱
        /// </summary>
        /// <param name="eClientManage">要处理的对象</param>
        /// <returns>返回是否处理成功</returns>
        public string Save(E_tb_ClientManage eClientManage)
        {
            string msg = "0";

            eClientManage.EditPersonnelID = CurrentUserInfo.PersonnelID;
            eClientManage.AreaID          = CurrentUserInfo.AreaID;
            if (eClientManage.EditType == "Add")
            {
                tClientManage.Add(eClientManage);
                msg = "1";
            }
            else
            {
                tClientManage.Update(eClientManage);
                msg = "1";
            }
            return(msg);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(E_tb_ClientManage model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(E_tb_ClientManage model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(E_tb_ClientManage model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_ClientManage(");
            strSql.Append("ClientName,Contact,Email,Deputy,Address,Fixed,Tel,Fax,ZipCode,ClientLevel,PrepaidMoney,MainBusiness,YearEntrust,Incentives,ContractNo,ContractImgID,ContractPath,AreaID,EditPersonnelID)");
            strSql.Append(" values (");
            strSql.Append("@ClientName,@Contact,@Email,@Deputy,@Address,@Fixed,@Tel,@Fax,@ZipCode,@ClientLevel,@PrepaidMoney,@MainBusiness,@YearEntrust,@Incentives,@ContractNo,@ContractImgID,@ContractPath,@AreaID,@EditPersonnelID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ClientName",      SqlDbType.NVarChar,  50),
                new SqlParameter("@Contact",         SqlDbType.NVarChar,  50),
                new SqlParameter("@Email",           SqlDbType.NVarChar,  50),
                new SqlParameter("@Deputy",          SqlDbType.NVarChar,  50),
                new SqlParameter("@Address",         SqlDbType.NVarChar, 200),
                new SqlParameter("@Fixed",           SqlDbType.NVarChar,  50),
                new SqlParameter("@Tel",             SqlDbType.NVarChar,  50),
                new SqlParameter("@Fax",             SqlDbType.NVarChar,  50),
                new SqlParameter("@ZipCode",         SqlDbType.NVarChar,  50),
                new SqlParameter("@ClientLevel",     SqlDbType.NVarChar,  50),
                new SqlParameter("@PrepaidMoney",    SqlDbType.NVarChar,  50),
                new SqlParameter("@MainBusiness",    SqlDbType.Text),
                new SqlParameter("@YearEntrust",     SqlDbType.Text),
                new SqlParameter("@Incentives",      SqlDbType.Text),
                new SqlParameter("@ContractNo",      SqlDbType.NVarChar,  50),
                new SqlParameter("@ContractImgID",   SqlDbType.Int,        4),
                new SqlParameter("@ContractPath",    SqlDbType.NVarChar,  50),
                new SqlParameter("@AreaID",          SqlDbType.Int,        4),
                new SqlParameter("@EditPersonnelID", SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.ClientName;
            parameters[1].Value  = model.Contact;
            parameters[2].Value  = model.Email;
            parameters[3].Value  = model.Deputy;
            parameters[4].Value  = model.Address;
            parameters[5].Value  = model.Fixed;
            parameters[6].Value  = model.Tel;
            parameters[7].Value  = model.Fax;
            parameters[8].Value  = model.ZipCode;
            parameters[9].Value  = model.ClientLevel;
            parameters[10].Value = model.PrepaidMoney;
            parameters[11].Value = model.MainBusiness;
            parameters[12].Value = model.YearEntrust;
            parameters[13].Value = model.Incentives;
            parameters[14].Value = model.ContractNo;
            parameters[15].Value = model.ContractImgID;
            parameters[16].Value = model.ContractPath;
            parameters[17].Value = model.AreaID;
            parameters[18].Value = model.EditPersonnelID;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public E_tb_ClientManage GetModel(int ClientID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ClientID,ClientName,Contact,Email,Deputy,Address,Fixed,Tel,Fax,ZipCode,ClientLevel,PrepaidMoney,MainBusiness,YearEntrust,Incentives,ContractNo,ContractImgID,ContractPath,AreaID,EditPersonnelID from tb_ClientManage ");
            strSql.Append(" where ClientID=@ClientID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ClientID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ClientID;

            E_tb_ClientManage model = new E_tb_ClientManage();
            DataSet           ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ClientID"].ToString() != "")
                {
                    model.ClientID = int.Parse(ds.Tables[0].Rows[0]["ClientID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ClientName"] != null)
                {
                    model.ClientName = ds.Tables[0].Rows[0]["ClientName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Contact"] != null)
                {
                    model.Contact = ds.Tables[0].Rows[0]["Contact"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null)
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Deputy"] != null)
                {
                    model.Deputy = ds.Tables[0].Rows[0]["Deputy"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null)
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Fixed"] != null)
                {
                    model.Fixed = ds.Tables[0].Rows[0]["Fixed"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null)
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Fax"] != null)
                {
                    model.Fax = ds.Tables[0].Rows[0]["Fax"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ZipCode"] != null)
                {
                    model.ZipCode = ds.Tables[0].Rows[0]["ZipCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ClientLevel"] != null)
                {
                    model.ClientLevel = ds.Tables[0].Rows[0]["ClientLevel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PrepaidMoney"] != null)
                {
                    model.PrepaidMoney = ds.Tables[0].Rows[0]["PrepaidMoney"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MainBusiness"] != null)
                {
                    model.MainBusiness = ds.Tables[0].Rows[0]["MainBusiness"].ToString();
                }
                if (ds.Tables[0].Rows[0]["YearEntrust"] != null)
                {
                    model.YearEntrust = ds.Tables[0].Rows[0]["YearEntrust"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Incentives"] != null)
                {
                    model.Incentives = ds.Tables[0].Rows[0]["Incentives"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ContractNo"] != null)
                {
                    model.ContractNo = ds.Tables[0].Rows[0]["ContractNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ContractImgID"].ToString() != "")
                {
                    model.ContractImgID = int.Parse(ds.Tables[0].Rows[0]["ContractImgID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ContractPath"] != null)
                {
                    model.ContractPath = ds.Tables[0].Rows[0]["ContractPath"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AreaID"].ToString() != "")
                {
                    model.AreaID = int.Parse(ds.Tables[0].Rows[0]["AreaID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["EditPersonnelID"].ToString() != "")
                {
                    model.EditPersonnelID = int.Parse(ds.Tables[0].Rows[0]["EditPersonnelID"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(E_tb_ClientManage model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_ClientManage set ");
            strSql.Append("ClientName=@ClientName,");
            strSql.Append("Contact=@Contact,");
            strSql.Append("Email=@Email,");
            strSql.Append("Deputy=@Deputy,");
            strSql.Append("Address=@Address,");
            strSql.Append("Fixed=@Fixed,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Fax=@Fax,");
            strSql.Append("ZipCode=@ZipCode,");
            strSql.Append("ClientLevel=@ClientLevel,");
            strSql.Append("PrepaidMoney=@PrepaidMoney,");
            strSql.Append("MainBusiness=@MainBusiness,");
            strSql.Append("YearEntrust=@YearEntrust,");
            strSql.Append("Incentives=@Incentives,");
            strSql.Append("ContractNo=@ContractNo,");
            strSql.Append("ContractImgID=@ContractImgID,");
            strSql.Append("ContractPath=@ContractPath,");
            strSql.Append("AreaID=@AreaID,");
            strSql.Append("EditPersonnelID=@EditPersonnelID");
            strSql.Append(" where ClientID=@ClientID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ClientName",      SqlDbType.NVarChar,  50),
                new SqlParameter("@Contact",         SqlDbType.NVarChar,  50),
                new SqlParameter("@Email",           SqlDbType.NVarChar,  50),
                new SqlParameter("@Deputy",          SqlDbType.NVarChar,  50),
                new SqlParameter("@Address",         SqlDbType.NVarChar, 200),
                new SqlParameter("@Fixed",           SqlDbType.NVarChar,  50),
                new SqlParameter("@Tel",             SqlDbType.NVarChar,  50),
                new SqlParameter("@Fax",             SqlDbType.NVarChar,  50),
                new SqlParameter("@ZipCode",         SqlDbType.NVarChar,  50),
                new SqlParameter("@ClientLevel",     SqlDbType.NVarChar,  50),
                new SqlParameter("@PrepaidMoney",    SqlDbType.NVarChar,  50),
                new SqlParameter("@MainBusiness",    SqlDbType.Text),
                new SqlParameter("@YearEntrust",     SqlDbType.Text),
                new SqlParameter("@Incentives",      SqlDbType.Text),
                new SqlParameter("@ContractNo",      SqlDbType.NVarChar,  50),
                new SqlParameter("@ContractImgID",   SqlDbType.Int,        4),
                new SqlParameter("@ContractPath",    SqlDbType.NVarChar,  50),
                new SqlParameter("@AreaID",          SqlDbType.Int,        4),
                new SqlParameter("@EditPersonnelID", SqlDbType.Int,        4),
                new SqlParameter("@ClientID",        SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.ClientName;
            parameters[1].Value  = model.Contact;
            parameters[2].Value  = model.Email;
            parameters[3].Value  = model.Deputy;
            parameters[4].Value  = model.Address;
            parameters[5].Value  = model.Fixed;
            parameters[6].Value  = model.Tel;
            parameters[7].Value  = model.Fax;
            parameters[8].Value  = model.ZipCode;
            parameters[9].Value  = model.ClientLevel;
            parameters[10].Value = model.PrepaidMoney;
            parameters[11].Value = model.MainBusiness;
            parameters[12].Value = model.YearEntrust;
            parameters[13].Value = model.Incentives;
            parameters[14].Value = model.ContractNo;
            parameters[15].Value = model.ContractImgID;
            parameters[16].Value = model.ContractPath;
            parameters[17].Value = model.AreaID;
            parameters[18].Value = model.EditPersonnelID;
            parameters[19].Value = model.ClientID;

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

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