/// <summary>
 /// 更新资产状态
 /// </summary>
 /// <param name="model"></param>
 public void AddDicByUpdateAssets(Models.ys_ScrapOrder model)
 {
     if (!model.IsAudit)
     {
         string         sqlText = @"UPDATE [AssetsSys].[dbo].[ys_Assets]
             SET [StatusId] = @StatusId
                ,[IsRemoved]=0
                 WHERE [Id] = @Id";
         SqlParameter   s1      = new SqlParameter("@Id", model.AssetsId);
         SqlParameter   s2      = new SqlParameter("@StatusId", model.OldStatusId);
         SqlParameter[] cmdPara = new SqlParameter[] { s1, s2 };
         dicCmd.Add(cmdPara, sqlText);
     }
     else
     {
         string         sqlText = @"UPDATE [AssetsSys].[dbo].[ys_Assets]
             SET [StatusId] = @StatusId
                ,[IsRemoved]=1
                 WHERE [Id] = @Id";
         SqlParameter   s1      = new SqlParameter("@Id", model.AssetsId);
         SqlParameter   s2      = new SqlParameter("@StatusId", "BF");
         SqlParameter[] cmdPara = new SqlParameter[] { s1, s2 };
         dicCmd.Add(cmdPara, sqlText);
     }
 }
        /// <summary>
        /// 新增报废记录
        /// </summary>
        /// <param name="model"></param>
        public void AddDicByRepairOrder(Models.ys_ScrapOrder model)
        {
            #region sqltext
            string sqlText = @"INSERT INTO [AssetsSys].[dbo].[ys_ScrapOrder]
           ([Id]
           ,[ScrapNo]
           ,[AssetsId]
           ,[OldStatusId]
           ,[ScrapUserId]
           ,[ScrapUserName]
           ,[Scrapday]
           ,[OperatorId]
           ,[OperatorName]
           ,[ScrapDescription]
           ,[IsAudit]
           ,[CreateTime]
           ,[IsRemoved])
     VALUES(@Id
           ,@ScrapNo
           ,@AssetsId
           ,@OldStatusId
           ,@ScrapUserId
           ,@ScrapUserName
           ,@Scrapday
           ,@OperatorId
           ,@OperatorName
           ,@ScrapDescription
           ,@IsAudit
           ,@CreateTime
           ,@IsRemoved)";
            #endregion

            #region  sqlParam
            SqlParameter s1  = new SqlParameter("@Id", model.Id);
            SqlParameter s2  = new SqlParameter("@ScrapNo", model.ScrapNo);
            SqlParameter s3  = new SqlParameter("@AssetsId", model.AssetsId);
            SqlParameter s4  = new SqlParameter("@OldStatusId", model.OldStatusId);
            SqlParameter s5  = new SqlParameter("@ScrapUserId", model.ScrapUserId);
            SqlParameter s6  = new SqlParameter("@ScrapUserName", model.ScrapUserName);
            SqlParameter s7  = new SqlParameter("@Scrapday", model.Scrapday);
            SqlParameter s8  = new SqlParameter("@OperatorId", model.OperatorId);
            SqlParameter s9  = new SqlParameter("@OperatorName", model.OperatorName);
            SqlParameter s10 = new SqlParameter("@ScrapDescription", model.ScrapDescription);
            SqlParameter s11 = new SqlParameter("@IsAudit", model.IsAudit);
            SqlParameter s12 = new SqlParameter("@CreateTime", model.CreateTime);
            SqlParameter s13 = new SqlParameter("@IsRemoved", model.IsRemoved);
            #endregion
            SqlParameter[] cmdPara = new SqlParameter[] { s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13 };
            dicCmd.Add(cmdPara, sqlText);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 保存领用单信息
 /// </summary>
 private void sbtnSave_Click(object sender, EventArgs e)
 {
     //检查用户输入是否合法、部门、人员、资产信息
     if (StaffID.EditValue != null && selectAssets.Count > 0)
     {
         List <Models.ys_ScrapOrder> list = new List <Models.ys_ScrapOrder>();
         foreach (Models.ys_Assets a in selectAssets)
         {
             var model = new Models.ys_ScrapOrder();
             model.ScrapNo          = bll.GetNewScrapNo();//生成订单号
             model.ScrapUserId      = clsPublic.GetObjGUID(StaffID.EditValue);
             model.ScrapUserName    = StaffID.Text;
             model.OperatorId       = clsSession._UserId;
             model.OperatorName     = clsSession._FullName;
             model.ScrapDescription = txt_Desc.Text;
             model.Scrapday         = bfday.DateTime;
             model.IsAudit          = true;
             model.AssetsId         = a.Id;
             model.IsRemoved        = false;
             model.OldStatusId      = a.StatusId;
             model.CreateTime       = DateTime.Now;
             list.Add(model);
         }
         //生成新的领用单
         if (bll.AddNew(list))
         {
             clsPublic.ShowMessage("保存成功!", Text);
             base.DialogResult = DialogResult.OK;
         }
         else
         {
             clsPublic.ShowMessage("保存失败!", Text);
         }
     }
     else
     {
         clsPublic.ShowMessage("职员、或清理的资产信息不能为空!", Text);
     }
 }
        /// <summary>
        /// 修改指定的报废记录
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public void AddDicModifyByRepairOrder(Models.ys_ScrapOrder model)
        {
            #region sqltext

            string sqlText = @"UPDATE [AssetsSys].[dbo].[ys_ScrapOrder]
                   SET [ScrapNo] = @ScrapNo
                      ,[AssetsId] = @AssetsId
                      ,[OldStatusId] = @OldStatusId
                      ,[ScrapUserId] = @ScrapUserId
                      ,[ScrapUserName] = @ScrapUserName
                      ,[Scrapday] = @Scrapday
                      ,[OperatorId] = @OperatorId
                      ,[OperatorName] = @OperatorName
                      ,[ScrapDescription] = @SrcapDescription
                      ,[IsAudit] = @IsAudit
                      ,[CreateTime] = @CreateTime
                      ,[IsRemoved] = @IsRemoved
                 WHERE [Id] = @Id";
            #endregion

            #region  sqlParam
            SqlParameter s1  = new SqlParameter("@Id", model.Id);
            SqlParameter s2  = new SqlParameter("@ScrapNo", model.ScrapNo);
            SqlParameter s3  = new SqlParameter("@AssetsId", model.AssetsId);
            SqlParameter s4  = new SqlParameter("@OldStatusId", model.OldStatusId);
            SqlParameter s5  = new SqlParameter("@ScrapUserId", model.ScrapUserId);
            SqlParameter s6  = new SqlParameter("@ScrapUserName", model.ScrapUserName);
            SqlParameter s7  = new SqlParameter("@Scrapday", model.Scrapday);
            SqlParameter s8  = new SqlParameter("@OperatorId", model.OperatorId);
            SqlParameter s9  = new SqlParameter("@OperatorName", model.OperatorName);
            SqlParameter s10 = new SqlParameter("@ScrapDescription", model.ScrapDescription);
            SqlParameter s11 = new SqlParameter("@IsAudit", model.IsAudit);
            SqlParameter s12 = new SqlParameter("@CreateTime", model.CreateTime);
            SqlParameter s13 = new SqlParameter("@IsRemoved", model.IsRemoved);
            #endregion
            SqlParameter[] cmdPara = new SqlParameter[] { s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13 };
            dicCmd.Add(cmdPara, sqlText);
        }
 /// <summary>
 /// 修改指定的维修记录
 /// </summary>
 /// <param name="model">实体</param>
 /// <returns></returns>
 public bool Modify(Models.ys_ScrapOrder model)
 {
     return(sev.Modify(new List <Models.ys_ScrapOrder> {
         model
     }));
 }