コード例 #1
0
        /// <summary>
        /// 新增工作记录
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public bool AddNew(Models.ys_JobRecord model)
        {
            string sqlText = @"INSERT INTO [RightingSys].[dbo].[ys_JobRecord]
           ([Id]
           ,[BranchId]
           ,[BranchName]
           ,[StaffId]
           ,[StaffName]
           ,[CategoryId]
           ,[CategoryName]
           ,[Contact]
           ,[ContactNumber]
           ,[Description]
           ,[CreatorId]
           ,[CreatorName])
     VALUES(@Id
           ,@BranchId
           ,@BranchName
           ,@StaffId
           ,@StaffName
           ,@CategoryId
           ,@CategoryName
           ,@Contact
           ,@ContactNumber
           ,@Description
           ,@CreatorId
           ,@CreatorName)";

            SqlParameter[] Params = new SqlParameter[] {
                new SqlParameter("@Id", model.Id = Guid.NewGuid()),
                new SqlParameter("@BranchId", model.BranchId),
                new SqlParameter("@BranchName", model.BranchName),
                new SqlParameter("@StaffId", model.StaffId),
                new SqlParameter("@StaffName", model.StaffName),
                new SqlParameter("@CategoryId", model.CategoryId),
                new SqlParameter("@CategoryName", model.CategoryName = ""),
                new SqlParameter("@Contact", model.Contact),
                new SqlParameter("@ContactNumber", model.ContactNumber = ""),
                new SqlParameter("@Description", model.Description),
                new SqlParameter("@CreatorId", model.CreatorId),
                new SqlParameter("@CreatorName", model.CreatorName)
            };

            return(Models.SqlHelper.ExecuteNoQuery(sqlText, Params) > 0);
        }
コード例 #2
0
        /// <summary>
        /// 修改工作记录
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public bool Modify(Models.ys_JobRecord model)
        {
            string sqlText = @"UPDATE [RightingSys].[dbo].[ys_JobRecord]
                               SET [BranchId] = @BranchId
                                  ,[BranchName] = @BranchName
                                  ,[StaffId] = @StaffId
                                  ,[StaffName] = @StaffName
                                  ,[CategoryId] = @CategoryId
                                  ,[CategoryName] = @CategoryName
                                  ,[Contact] = @Contact
                                  ,[ContactNumber] = @ContactNumber
                                  ,[Description] = @Description
                                  ,[CreateTime]=@CreateTime
                                  ,[Solution] = @Solution
                                  ,[OperatorId] = @OperatorId
                                  ,[OperatorName] = @OperatorName
                                  ,[FinishTime] = @FinishTime
                                  ,[TotalMins] = DATEDIFF(N,@CreateTime,ISNULL(@FinishTime,GETDATE()))
                                  ,[IsFinish] = @IsFinish
                             WHERE [Id] = @Id";

            SqlParameter[] Params = new SqlParameter[] {
                new SqlParameter("@Id", model.Id),
                new SqlParameter("@BranchId", model.BranchId),
                new SqlParameter("@BranchName", model.BranchName),
                new SqlParameter("@StaffId", model.StaffId),
                new SqlParameter("@StaffName", model.StaffName),
                new SqlParameter("@CategoryId", model.CategoryId),
                new SqlParameter("@CategoryName", model.CategoryName),
                new SqlParameter("@Contact", model.Contact),
                new SqlParameter("@ContactNumber", model.ContactNumber),
                new SqlParameter("@Description", model.Description),
                new SqlParameter("@Solution", model.Solution),
                new SqlParameter("@OperatorId", model.OperatorId),
                new SqlParameter("@OperatorName", model.OperatorName),
                new SqlParameter("@FinishTime", model.FinishTime),
                //new SqlParameter("@TotalMins",model.TotalMins),
                new SqlParameter("@IsFinish", model.IsFinish),
                new SqlParameter("@CreateTime", model.CreateTime),
            };

            return(Models.SqlHelper.ExecuteNoQuery(sqlText, Params) > 0);
        }
コード例 #3
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="md">实体</param>
        public JobSolutionForm(Models.ys_JobRecord md)
        {
            InitializeComponent();

            cbBranch.Properties.DataSource      = manager.GetDtBranch();
            tlJobCategory.Properties.DataSource = manager.GetAllListCategory();
            cbStaff.Properties.DataSource       = Usermanager.GetAllList();

            if (md != null)
            {
                model = md;
                cbBranch.EditValue         = model.BranchId.Trim();
                txtContact.Text            = model.Contact;
                cbStaff.EditValue          = model.StaffId;
                this.txtDescription.Text   = model.Description;
                this.txtCreatorName.Text   = model.CreatorName;
                this.txtStartTime.DateTime = model.CreateTime;
            }
        }
コード例 #4
0
 /// <summary>
 /// 修改工作记录
 /// </summary>
 /// <param name="model">实体</param>
 /// <returns></returns>
 public bool Modify(Models.ys_JobRecord model)
 {
     return(sev.Modify(model));
 }
コード例 #5
0
 /// <summary>
 /// 新增工作记录
 /// </summary>
 /// <param name="model">实体</param>
 /// <returns></returns>
 public bool AddNew(Models.ys_JobRecord model)
 {
     return(sev.AddNew(model));
 }