Ejemplo n.º 1
0
        private List <ITC_Position_M> DsToList(DataSet ds)
        {
            List <ITC_Position_M> list = new List <ITC_Position_M>();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                ITC_Position_M model = null;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    model                 = new ITC_Position_M();
                    model.Position_ID     = ds.Tables[0].Rows[i]["Position_ID"].ToString().Trim();
                    model.Position_name   = ds.Tables[0].Rows[i]["Position_name"].ToString();
                    model.Position_remark = ds.Tables[0].Rows[i]["Position_remark"].ToString();
                    if (ds.Tables[0].Rows[i]["Position_status"].ToString() != "")
                    {
                        model.Position_status = int.Parse(ds.Tables[0].Rows[i]["Position_status"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["Position_createdtime"].ToString() != "")
                    {
                        model.Position_createdtime = DateTime.Parse(ds.Tables[0].Rows[i]["Position_createdtime"].ToString());
                    }
                    model.Position_Oprt = ds.Tables[0].Rows[i]["Position_Oprt"].ToString();
                    if (ds.Tables[0].Rows[i]["Position_Order"].ToString() != "")
                    {
                        model.Position_Order = int.Parse(ds.Tables[0].Rows[i]["Position_Order"].ToString());
                    }

                    list.Add(model);
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ITC_Position_M model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ITC_Position set ");
            strSql.Append(" Position_name = @Position_name , ");
            strSql.Append(" Position_remark = @Position_remark , ");
            strSql.Append(" Position_status = @Position_status , ");
            strSql.Append(" Position_Order = @Position_Order , ");
            strSql.Append(" Position_createdtime = @Position_createdtime , ");
            strSql.Append(" Position_Oprt = @Position_Oprt  ");
            strSql.Append(" where Position_ID=@Position_ID  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Position_ID",          SqlDbType.VarChar,    10),
                new SqlParameter("@Position_name",        SqlDbType.VarChar,    50),
                new SqlParameter("@Position_remark",      SqlDbType.VarChar,   500),
                new SqlParameter("@Position_status",      SqlDbType.Int,         4),
                new SqlParameter("@Position_Order",       SqlDbType.Int,         4),
                new SqlParameter("@Position_createdtime", SqlDbType.DateTime),
                new SqlParameter("@Position_Oprt",        SqlDbType.VarChar, 50)
            };

            parameters[0].Value = model.Position_ID;
            parameters[1].Value = model.Position_name;
            parameters[2].Value = model.Position_remark;
            parameters[3].Value = model.Position_status;
            parameters[4].Value = model.Position_Order;
            parameters[5].Value = model.Position_createdtime;
            parameters[6].Value = model.Position_Oprt;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 //编辑保存
 public ActionResult SaveEdit(ITC_Position_M model)
 {
     if (uifo.Exists(model.Position_ID))
     {
         model.Position_createdtime = DateTime.Now;
         model.Position_Oprt        = UserContext.UserName;
         if (uifo.Update(model))
         {
             EventContext.Add(MenuID, string.Format("修改:{0}", model.Position_ID));
             return(Content("保存成功!"));
         }
         else
         {
             return(Content("保存失败!"));
         }
     }
     else
     {
         return(Content("保存失败! 编码[" + model.Position_ID + "]不存在!"));
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ITC_Position_M model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ITC_Position(");
            strSql.Append("Position_ID,Position_name,Position_remark,Position_status,Position_createdtime,Position_Oprt,Position_Order");
            strSql.Append(") values (");
            strSql.Append("@Position_ID,@Position_name,@Position_remark,@Position_status,@Position_createdtime,@Position_Oprt,@Position_Order");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Position_ID",          SqlDbType.VarChar,    10),
                new SqlParameter("@Position_name",        SqlDbType.VarChar,    50),
                new SqlParameter("@Position_remark",      SqlDbType.VarChar,   500),
                new SqlParameter("@Position_status",      SqlDbType.Int,         4),
                new SqlParameter("@Position_Order",       SqlDbType.Int,         4),
                new SqlParameter("@Position_createdtime", SqlDbType.DateTime),
                new SqlParameter("@Position_Oprt",        SqlDbType.VarChar, 50)
            };

            parameters[0].Value = model.Position_ID;
            parameters[1].Value = model.Position_name;
            parameters[2].Value = model.Position_remark;
            parameters[3].Value = model.Position_status;
            parameters[4].Value = model.Position_Order;
            parameters[5].Value = model.Position_createdtime;
            parameters[6].Value = model.Position_Oprt;
            int result = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        //获取岗位信息
        public string GetPositionName(string pid)
        {
            ITC_Position_M model = GetModel(pid);

            return(model != null ? model.Position_name : "");
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update(ITC_Position_M model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Add(ITC_Position_M model)
 {
     return(dal.Add(model));
 }
Ejemplo n.º 8
0
        //获取模型
        public ActionResult GetModel(string id)
        {
            ITC_Position_M mo = uifo.GetModel(id);

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