Beispiel #1
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.user_pm   bll   = new BLL.user_pm();
                Model.user_pm model = bll.GetModel(_id);
                model.name      = txtName.Text;
                model.sex       = Convert.ToInt32(rblSex.SelectedValue);
                model.origin    = txtOrigin.Text;
                model.phone     = txtPhone.Text;
                model.comname   = txtComName.Text;
                model.job       = txtJob.Text;
                model.year      = Convert.ToInt32(txtYear.Text);
                model.jobimg    = jobImg.Text;
                model.img       = txtImg.Text;
                model.add_time  = Convert.ToDateTime(txtAddTime.Text);
                model.pass_time = Convert.ToDateTime(txtPassTime.Text);


                if (bll.Update(model))
                {
                    AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改产品经理信息"); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">Model.user_pm</param>
        /// <returns>True or False</returns>
        public bool Update(Model.user_pm model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [" + databaseprefix + "user_pm] set ");
            strSql.Append("user_id=@user_id,");
            strSql.Append("name=@name,");
            strSql.Append("sex=@sex,");
            strSql.Append("origin=@origin,");
            strSql.Append("phone=@phone,");
            strSql.Append("comname=@comname,");
            strSql.Append("job=@job,");
            strSql.Append("year=@year,");
            strSql.Append("jobimg=@jobimg,");
            strSql.Append("img=@img,");
            strSql.Append("status=@status,");
            strSql.Append("add_time=@add_time,");
            strSql.Append("pass_time=@pass_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@user_id",   SqlDbType.Int,         4),
                new SqlParameter("@name",      SqlDbType.VarChar,   100),
                new SqlParameter("@sex",       SqlDbType.Int,         4),
                new SqlParameter("@origin",    SqlDbType.NVarChar,  100),
                new SqlParameter("@phone",     SqlDbType.NVarChar,  100),
                new SqlParameter("@comname",   SqlDbType.NVarChar,  100),
                new SqlParameter("@job",       SqlDbType.NVarChar,  100),
                new SqlParameter("@year",      SqlDbType.Int,         4),
                new SqlParameter("@jobimg",    SqlDbType.NText),
                new SqlParameter("@img",       SqlDbType.NText),
                new SqlParameter("@status",    SqlDbType.Int,         4),
                new SqlParameter("@add_time",  SqlDbType.DateTime),
                new SqlParameter("@pass_time", SqlDbType.DateTime),
                new SqlParameter("@id",        SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.user_id;
            parameters[1].Value  = model.name;
            parameters[2].Value  = model.sex;
            parameters[3].Value  = model.origin;
            parameters[4].Value  = model.phone;
            parameters[5].Value  = model.comname;
            parameters[6].Value  = model.job;
            parameters[7].Value  = model.year;
            parameters[8].Value  = model.jobimg;
            parameters[9].Value  = model.img;
            parameters[10].Value = model.status;
            parameters[11].Value = model.add_time;
            parameters[12].Value = model.pass_time;
            parameters[13].Value = model.id;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">Model.user_pm</param>
        /// <returns>ID</returns>
        public int Add(Model.user_pm model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [" + databaseprefix + "user_pm](");
            strSql.Append("user_id,name,sex,origin,phone,comname,job,year,jobimg,img,status,add_time");
            strSql.Append(") values(");
            strSql.Append("@user_id,@name,@sex,@origin,@phone,@comname,@job,@year,@jobimg,@img,@status,@add_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@user_id",  SqlDbType.Int,        4),
                new SqlParameter("@name",     SqlDbType.VarChar,  100),
                new SqlParameter("@sex",      SqlDbType.Int,        4),
                new SqlParameter("@origin",   SqlDbType.NVarChar, 100),
                new SqlParameter("@phone",    SqlDbType.NVarChar, 100),
                new SqlParameter("@comname",  SqlDbType.NVarChar, 100),
                new SqlParameter("@job",      SqlDbType.NVarChar, 100),
                new SqlParameter("@year",     SqlDbType.Int,        4),
                new SqlParameter("@jobimg",   SqlDbType.NText),
                new SqlParameter("@img",      SqlDbType.NText),
                new SqlParameter("@status",   SqlDbType.Int,        4),
                new SqlParameter("@add_time", SqlDbType.DateTime)
            };
            parameters[0].Value  = model.user_id;
            parameters[1].Value  = model.name;
            parameters[2].Value  = model.sex;
            parameters[3].Value  = model.origin;
            parameters[4].Value  = model.phone;
            parameters[5].Value  = model.comname;
            parameters[6].Value  = model.job;
            parameters[7].Value  = model.year;
            parameters[8].Value  = model.jobimg;
            parameters[9].Value  = model.img;
            parameters[10].Value = model.status;
            parameters[11].Value = model.add_time;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (null != obj)
            {
                return(Convert.ToInt32(obj));
            }
            else
            {
                return(0);
            }
        }
Beispiel #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">Model.user_pm</param>
 /// <returns>ID</returns>
 public int Add(Model.user_pm model)
 {
     return(dal.Add(model));
 }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">Model.user_pm</param>
 /// <returns>True Or False</returns>
 public bool Update(Model.user_pm model)
 {
     return(dal.Update(model));
 }
Beispiel #6
0
        private void register_pm(HttpContext context)
        {
            int    uid      = DTRequest.GetInt("uid", 0);
            string name     = DTRequest.GetString("name");
            string birthday = DTRequest.GetString("birthday");
            int    sex      = DTRequest.GetInt("sex", 0);
            string origin   = DTRequest.GetString("origin");
            string phone    = DTRequest.GetString("phone");
            string comName  = DTRequest.GetString("comName");
            string job      = DTRequest.GetString("job");
            int    year     = DTRequest.GetInt("year", 0);
            string jobImg   = DTRequest.GetString("jobImg");
            string img      = DTRequest.GetString("img");

            if (uid == 0)
            {
                context.Response.Write("{\"status\":0,\"msg\":\"未登录,请登录后重新提交!\"}");
                return;
            }
            if (name == "")
            {
                context.Response.Write("{\"status\":0,\"msg\":\"请输入姓名!\"}");
                return;
            }
            if (sex == 0)
            {
                context.Response.Write("{\"status\":0,\"msg\":\"请选择性别!\"}");
                return;
            }
            if (origin == "")
            {
                context.Response.Write("{\"status\":0,\"msg\":\"请输入籍贯!\"}");
                return;
            }
            if (phone == "")
            {
                context.Response.Write("{\"status\":0,\"msg\":\"请输入电话号码!\"}");
                return;
            }
            if (comName == "")
            {
                context.Response.Write("{\"status\":0,\"msg\":\"请输入公司名称!\"}");
                return;
            }
            if (job == "")
            {
                context.Response.Write("{\"status\":0,\"msg\":\"请输入所在岗位!\"}");
                return;
            }
            if (jobImg == "" || jobImg == "undefined" || img == "" || img == "undefined")
            {
                context.Response.Write("{\"status\":0,\"msg\":\"请上传工牌照片和生活照!\"}");
                return;
            }

            Model.user_pm model = new Model.user_pm();
            model.user_id  = uid;
            model.name     = name;
            model.sex      = sex;
            model.origin   = origin;
            model.phone    = phone;
            model.comname  = comName;
            model.job      = job;
            model.year     = year;
            model.jobimg   = jobImg;
            model.img      = img;
            model.status   = 1;
            model.add_time = DateTime.Now;

            if (new BLL.user_pm().Add(model) > 0)
            {
                new BLL.user().UpdateField(uid, "level=1");
                context.Response.Write("{\"status\":1,\"msg\":\"提交成功!\"}");
            }
            else
            {
                context.Response.Write("{\"status\":0,\"msg\":\"提交失败,请重新提交!\"}");
            }
        }
Beispiel #7
0
 /// <summary>
 /// 组合成对象实体
 /// </summary>
 /// <param name="row">一行数据</param>
 /// <returns>Model.user_pm</returns>
 private Model.user_pm DataRowToModel(DataRow row)
 {
     Model.user_pm model = new Model.user_pm();
     if (row != null)
     {
         if (null != row["id"] && "" != row["id"].ToString())
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (null != row["user_id"] && "" != row["user_id"].ToString())
         {
             model.user_id = int.Parse(row["user_id"].ToString());
         }
         if (null != row["name"])
         {
             model.name = row["name"].ToString();
         }
         if (null != row["sex"] && "" != row["sex"].ToString())
         {
             model.sex = int.Parse(row["sex"].ToString());
         }
         if (null != row["origin"])
         {
             model.origin = row["origin"].ToString();
         }
         if (null != row["phone"])
         {
             model.phone = row["phone"].ToString();
         }
         if (null != row["comname"])
         {
             model.comname = row["comname"].ToString();
         }
         if (null != row["job"])
         {
             model.job = row["job"].ToString();
         }
         if (null != row["year"] && "" != row["year"].ToString())
         {
             model.year = int.Parse(row["year"].ToString());
         }
         if (null != row["jobimg"])
         {
             model.jobimg = row["jobimg"].ToString();
         }
         if (null != row["img"])
         {
             model.img = row["img"].ToString();
         }
         if (null != row["status"] && "" != row["status"].ToString())
         {
             model.status = int.Parse(row["status"].ToString());
         }
         if (null != row["add_time"] && "" != row["add_time"].ToString())
         {
             model.add_time = DateTime.Parse(row["add_time"].ToString());
         }
         if (null != row["pass_time"] && "" != row["pass_time"].ToString())
         {
             model.pass_time = DateTime.Parse(row["pass_time"].ToString());
         }
     }
     return(model);
 }