Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TSM.Model.pms_OutAssistance_WorkPlan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update pms_OutAssistance_WorkPlan set ");
            strSql.Append("PlanMonth=@PlanMonth,");
            strSql.Append("WorkTypeID=@WorkTypeID,");
            strSql.Append("WorkContentID=@WorkContentID,");
            strSql.Append("WorkPlan=@WorkPlan,");
            strSql.Append("PlanTime=@PlanTime,");
            strSql.Append("PlannerID=@PlannerID,");
            strSql.Append("Report=@Report,");
            strSql.Append("ReportTime=@ReportTime,");
            strSql.Append("ReporterID=@ReporterID,");
            strSql.Append("Completion=@Completion,");
            strSql.Append("Result=@Result,");
            strSql.Append("WorkHour=@WorkHour");
            strSql.Append(" where WorkPlanID=@WorkPlanID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WorkPlanID",    SqlDbType.Int,         4),
                new SqlParameter("@PlanMonth",     SqlDbType.VarChar,     7),
                new SqlParameter("@WorkTypeID",    SqlDbType.Int,         4),
                new SqlParameter("@WorkContentID", SqlDbType.Int,         4),
                new SqlParameter("@WorkPlan",      SqlDbType.VarChar,   300),
                new SqlParameter("@PlanTime",      SqlDbType.DateTime),
                new SqlParameter("@PlannerID",     SqlDbType.Int,         4),
                new SqlParameter("@Report",        SqlDbType.VarChar,   300),
                new SqlParameter("@ReportTime",    SqlDbType.DateTime),
                new SqlParameter("@ReporterID",    SqlDbType.Int,         4),
                new SqlParameter("@Completion",    SqlDbType.VarChar,    64),
                new SqlParameter("@Result",        SqlDbType.VarChar,    64),
                new SqlParameter("@WorkHour",      SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.WorkPlanID;
            parameters[1].Value  = model.PlanMonth;
            parameters[2].Value  = model.WorkTypeID;
            parameters[3].Value  = model.WorkContentID;
            parameters[4].Value  = model.WorkPlan;
            parameters[5].Value  = model.PlanTime;
            parameters[6].Value  = model.PlannerID;
            parameters[7].Value  = model.Report;
            parameters[8].Value  = model.ReportTime;
            parameters[9].Value  = model.ReporterID;
            parameters[10].Value = model.Completion;
            parameters[11].Value = model.Result;
            parameters[12].Value = model.WorkHour;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TSM.Model.pms_OutAssistance_WorkPlan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into pms_OutAssistance_WorkPlan(");
            strSql.Append("PlanMonth,WorkTypeID,WorkContentID,WorkPlan,PlanTime,PlannerID,Report,ReportTime,ReporterID,Completion,Result,WorkHour)");
            strSql.Append(" values (");
            strSql.Append("@PlanMonth,@WorkTypeID,@WorkContentID,@WorkPlan,@PlanTime,@PlannerID,@Report,@ReportTime,@ReporterID,@Completion,@Result,@WorkHour)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PlanMonth",     SqlDbType.VarChar,     7),
                new SqlParameter("@WorkTypeID",    SqlDbType.Int,         4),
                new SqlParameter("@WorkContentID", SqlDbType.Int,         4),
                new SqlParameter("@WorkPlan",      SqlDbType.VarChar,   300),
                new SqlParameter("@PlanTime",      SqlDbType.DateTime),
                new SqlParameter("@PlannerID",     SqlDbType.Int,         4),
                new SqlParameter("@Report",        SqlDbType.VarChar,   300),
                new SqlParameter("@ReportTime",    SqlDbType.DateTime),
                new SqlParameter("@ReporterID",    SqlDbType.Int,         4),
                new SqlParameter("@Completion",    SqlDbType.VarChar,    64),
                new SqlParameter("@Result",        SqlDbType.VarChar,    64),
                new SqlParameter("@WorkHour",      SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.PlanMonth;
            parameters[1].Value  = model.WorkTypeID;
            parameters[2].Value  = model.WorkContentID;
            parameters[3].Value  = model.WorkPlan;
            parameters[4].Value  = model.PlanTime;
            parameters[5].Value  = model.PlannerID;
            parameters[6].Value  = model.Report;
            parameters[7].Value  = model.ReportTime;
            parameters[8].Value  = model.ReporterID;
            parameters[9].Value  = model.Completion;
            parameters[10].Value = model.Result;
            parameters[11].Value = model.WorkHour;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 3
0
        private void SaveWorkPlan()
        {
            var    cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            var    ticket = FormsAuthentication.Decrypt(cookie.Value);
            string uid    = ticket.UserData;

            TSM.Model.pms_OutAssistance_WorkPlan modelpms_OutAssistance_WorkPlan = new TSM.Model.pms_OutAssistance_WorkPlan();
            modelpms_OutAssistance_WorkPlan.PlanMonth     = da1.Text.ToString();
            modelpms_OutAssistance_WorkPlan.WorkTypeID    = int.Parse(ddlType.SelectedValue);
            modelpms_OutAssistance_WorkPlan.WorkContentID = int.Parse(ddlCont.SelectedValue);
            modelpms_OutAssistance_WorkPlan.WorkPlan      = txaPlan.Text.ToString();
            modelpms_OutAssistance_WorkPlan.PlanTime      = DateTime.Now.Date;
            modelpms_OutAssistance_WorkPlan.PlannerID     = int.Parse(uid);
            modelpms_OutAssistance_WorkPlan.Report        = "";
            modelpms_OutAssistance_WorkPlan.ReportTime    = Convert.ToDateTime("2000-01-01");
            modelpms_OutAssistance_WorkPlan.ReporterID    = int.Parse(ddlRept.SelectedValue);
            modelpms_OutAssistance_WorkPlan.Completion    = "";
            modelpms_OutAssistance_WorkPlan.Result        = "";
            modelpms_OutAssistance_WorkPlan.WorkHour      = 0;
            m_bllpms_OutAssistance_WorkPlan.Add(modelpms_OutAssistance_WorkPlan);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TSM.Model.pms_OutAssistance_WorkPlan GetModel(int WorkPlanID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 WorkPlanID,PlanMonth,WorkTypeID,WorkContentID,WorkPlan,PlanTime,PlannerID,Report,ReportTime,ReporterID,Completion,Result,WorkHour from pms_OutAssistance_WorkPlan ");
            strSql.Append(" where WorkPlanID=@WorkPlanID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WorkPlanID", SqlDbType.Int, 4)
            };
            parameters[0].Value = WorkPlanID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["WorkPlanID"].ToString() != "")
                {
                    model.WorkPlanID = int.Parse(ds.Tables[0].Rows[0]["WorkPlanID"].ToString());
                }
                model.PlanMonth = ds.Tables[0].Rows[0]["PlanMonth"].ToString();
                if (ds.Tables[0].Rows[0]["WorkTypeID"].ToString() != "")
                {
                    model.WorkTypeID = int.Parse(ds.Tables[0].Rows[0]["WorkTypeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["WorkContentID"].ToString() != "")
                {
                    model.WorkContentID = int.Parse(ds.Tables[0].Rows[0]["WorkContentID"].ToString());
                }
                model.WorkPlan = ds.Tables[0].Rows[0]["WorkPlan"].ToString();
                if (ds.Tables[0].Rows[0]["PlanTime"].ToString() != "")
                {
                    model.PlanTime = DateTime.Parse(ds.Tables[0].Rows[0]["PlanTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PlannerID"].ToString() != "")
                {
                    model.PlannerID = int.Parse(ds.Tables[0].Rows[0]["PlannerID"].ToString());
                }
                model.Report = ds.Tables[0].Rows[0]["Report"].ToString();
                if (ds.Tables[0].Rows[0]["ReportTime"].ToString() != "")
                {
                    model.ReportTime = DateTime.Parse(ds.Tables[0].Rows[0]["ReportTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ReporterID"].ToString() != "")
                {
                    model.ReporterID = int.Parse(ds.Tables[0].Rows[0]["ReporterID"].ToString());
                }
                model.Completion = ds.Tables[0].Rows[0]["Completion"].ToString();
                model.Result     = ds.Tables[0].Rows[0]["Result"].ToString();
                if (ds.Tables[0].Rows[0]["WorkHour"].ToString() != "")
                {
                    model.WorkHour = int.Parse(ds.Tables[0].Rows[0]["WorkHour"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }