protected void BindData(Assetremove remove)
 {
     //bind setup
     litRemoveId.Text = remove.Assetremoveid;//申请单号
     ucSeletedSystem.Assetcategoryid = remove.Assetcategoryid; //所属系统
     if (remove.Applydate.HasValue)
     {
         litApplysetupdate.Text = remove.Applydate.Value.ToString(UiConst.DateFormat); //申请安装日期
     }
     if (remove.Applydate.HasValue)
     {
         litApplyDate.Text = remove.Applydate.Value.ToString(UiConst.DateFormat);  //申请日期
     }
     litApplycontent.Text = remove.Applycontent;//申请内容
     ucApplyuser.UserId = remove.Applyuserid;//申请人
     litContactphone.Text = remove.Contactphone; //联系电话
     ucSelectProject.StorageId = remove.Storageid;
     ucSelectProject.Storagetitle = remove.Storagetitle;
     litProjectcontactorid.Text = remove.Projectcontactorid; // 项目体(分公司)联系人
     litProjectcontactorphone.Text = remove.Projectcontactorphone; //项目体(分公司)联系电话
     if (remove.Planremovedate.HasValue)
     {
         litPlansetupdate.Text = remove.Planremovedate.Value.ToString(UiConst.DateFormat); //计划安装日期
     }
     if (remove.Approvedate.HasValue)
     {
         litApprovedate.Text = remove.Approvedate.Value.ToString(UiConst.DateTimeFormat);//回复时间
     }
     litApproveuser.Text = remove.Approveuser;//审核人
 }
 protected void BindData(Assetremove RemoveInfo)
 {
     //bind Remove
     litRemoveid.Text = RemoveInfo.Assetremoveid;//申请单号
     ucSeletedSystem.Assetcategoryid = RemoveInfo.Assetcategoryid;
     ucApplyRemoveDate.DateValue = RemoveInfo.Applydate;
     ucApplyDate.DateValue = RemoveInfo.Applydate;
     txtApplycontent.Text = RemoveInfo.Applycontent;//申请内容
     ucApplyuser.UserId = RemoveInfo.Applyuserid;
     txtContactphone.Text = RemoveInfo.Contactphone; //联系电话
     ucSelectProject.StorageId = RemoveInfo.Storageid;
     ucSelectProject.Storagetitle = RemoveInfo.Storagetitle;
     txtProjectcontactorid.Text = RemoveInfo.Projectcontactorid; // 项目体(分公司)联系人
     txtProjectcontactorphone.Text = RemoveInfo.Projectcontactorphone; //项目体(分公司)联系电话
 }
 public Assetremove CreateAssetremove(Assetremove info)
 {
     try
     {
         info.Assetremoveid = new CoderuleManagement().GenerateCodeRule(Assetremove.RuleCode + DateTime.Today.ToString("yyyyMM"), false);
         Management.BeginTransaction();
         Management.CreateAssetremove(info);
         Management.Commit();
     }
     catch
     {
         Management.Rollback();
         throw;
     }
     return info;
 }
        public Assetremove CreateAssetremove(Assetremove info)
        {
            try
            {
                string sqlCommand = @"INSERT INTO ""ASSETREMOVE"" (""ASSETREMOVEID"",""ASSETCATEGORYID"",""APPLYDATE"",""APPLYUSERID"",""APPLYCONTENT"",""APPROVEUSER"",""APPROVEDATE"",""APPROVERESULT"",""PLANREMOVEDATE"",""ACTUALREMOVEDATE"",""REJECTREASON"",""CONFIRMDATE"",""CONFIRMUSER"",""REMOVEDCONTENT"",""STORAGETITLE"",""STORAGEID"",""SUBCOMPANY"",""SUBCOMPANYCONTACTORID"",""CONTACTPHONE"",""PROJECTCONTACTORID"",""PROJECTCONTACTORPHONE"",""CREATOR"",""CREATEDDATE"") VALUES (:Assetremoveid,:Assetcategoryid,:Applydate,:Applyuserid,:Applycontent,:Approveuser,:Approvedate,:Approveresult,:Planremovedate,:Actualremovedate,:Rejectreason,:Confirmdate,:Confirmuser,:Removedcontent,:Storagetitle,:Storageid,:Subcompany,:Subcompanycontactorid,:Contactphone,:Projectcontactorid,:Projectcontactorphone,:Creator,:Createddate)";
                this.Database.AddInParameter(":Assetremoveid", info.Assetremoveid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Assetcategoryid", info.Assetcategoryid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Applydate", info.Applydate);//DBType:DATE
                this.Database.AddInParameter(":Applyuserid", info.Applyuserid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Applycontent", info.Applycontent);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Approveuser", info.Approveuser);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Approvedate", info.Approvedate);//DBType:DATE
                this.Database.AddInParameter(":Approveresult", info.Approveresult);//DBType:NUMBER
                this.Database.AddInParameter(":Planremovedate", info.Planremovedate);//DBType:DATE
                this.Database.AddInParameter(":Actualremovedate", info.Actualremovedate);//DBType:DATE
                this.Database.AddInParameter(":Rejectreason", info.Rejectreason);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Confirmdate", info.Confirmdate);//DBType:DATE
                this.Database.AddInParameter(":Confirmuser", info.Confirmuser);//DBType:VARCHAR2
                this.Database.AddInParameter(":Removedcontent", info.Removedcontent);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Storagetitle", info.Storagetitle);//DBType:VARCHAR2
                this.Database.AddInParameter(":Storageid", info.Storageid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Subcompany", info.Subcompany);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Subcompanycontactorid", info.Subcompanycontactorid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Contactphone", info.Contactphone);//DBType:VARCHAR2
                this.Database.AddInParameter(":Projectcontactorid", info.Projectcontactorid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Projectcontactorphone", info.Projectcontactorphone);//DBType:VARCHAR2
                this.Database.AddInParameter(":Creator", info.Creator);//DBType:VARCHAR2
                this.Database.AddInParameter(":Createddate", info.Createddate);//DBType:DATE
                this.Database.ExecuteNonQuery(sqlCommand);

            }
            finally
            {
                this.Database.ClearParameter();
            }
            return info;
        }
 protected void SaveData(AssetRemoveState RemoveState)
 {
     Assetremove RemoveInfo = null;
     if (!string.IsNullOrEmpty(PageUtility.GetQueryStringValue("Assetremoveid"))) //修改
     {
         RemoveInfo = Assetremoveservice.RetrieveAssetremoveByAssetremoveid(Removeid);
         if (RemoveInfo == null) { return; }
         ExtractData(RemoveInfo);
         RemoveInfo.Approveresult = RemoveState;
         Assetremoveservice.UpdateAssetremoveByAssetremoveid(RemoveInfo);
         foreach (Assetremovedetail Assetremovedetail in RemoveDetail)
         {
             Assetremovedetail.Assetremoveid = RemoveInfo.Assetremoveid;
             if (AssetremovedetailService.RetrieveAssetremovedetailByDetailid(Assetremovedetail.Detailid) == null)
             {
                 AssetremovedetailService.CreateAssetremovedetail(Assetremovedetail);
             }
             else
             {
                 AssetremovedetailService.UpdateAssetremovedetailByDetailid(Assetremovedetail);
             }
         }
     }
     else //新增
     {
         RemoveInfo = new Assetremove();
         ExtractData(RemoveInfo);
         RemoveInfo.Approveresult = RemoveState;
         Assetremoveservice.CreateAssetremove(RemoveInfo);
         foreach (Assetremovedetail Assetremovedetail in RemoveDetail)
         {
             Assetremovedetail.Assetremoveid = RemoveInfo.Assetremoveid;
             AssetremovedetailService.CreateAssetremovedetail(Assetremovedetail);
         }
     }
 }
 protected void ExtractData(Assetremove assetRemoveinfo)
 {
     assetRemoveinfo.Assetremoveid = Removeid;//申请单号
     assetRemoveinfo.Assetcategoryid = ucSeletedSystem.Assetcategoryid;//(系统)设备大类
     assetRemoveinfo.Applydate = ucApplyRemoveDate.DateValue;//申请拆机日期
     assetRemoveinfo.Applycontent = txtApplycontent.Text;//申请内容
     assetRemoveinfo.Applydate = ucApplyDate.DateValue;//申请日期
     assetRemoveinfo.Applyuserid = ucApplyuser.UserId;//申请人
     assetRemoveinfo.Storagetitle = ucSelectProject.Storagetitle;//区分字段:分公司或项目体
     assetRemoveinfo.Storageid = ucSelectProject.StorageId;//项目体ID或分公司ID
     assetRemoveinfo.Contactphone = txtContactphone.Text;//联系电话
     assetRemoveinfo.Projectcontactorid = txtProjectcontactorid.Text.Trim();//项目体联系人
     assetRemoveinfo.Projectcontactorphone = txtProjectcontactorphone.Text;//项目体联系电话
     assetRemoveinfo.Createddate = DateTime.Now;//创建日期
     assetRemoveinfo.Creator = WebContext.Current.CurrentUser.Id;//创建人
 }
 protected void BindData(Assetremove remove)
 {
     //bind setup
     litRemoveid.Text = remove.Assetremoveid;//申请单号
     ucSeletedSystem.Assetcategoryid = remove.Assetcategoryid; //所属系统
     if (remove.Applydate.HasValue)
     {
         litApplysetupdate.Text = remove.Applydate.Value.ToString(UiConst.DateFormat); //申请拆机日期
     }
     if (remove.Applydate.HasValue)
     {
         litApplyDate.Text = remove.Applydate.Value.ToString(UiConst.DateFormat);  //申请日期
     }
     litApplycontent.Text = remove.Applycontent;//申请内容
     ucApplyuser.UserId = remove.Applyuserid;//申请人
     litContactphone.Text = remove.Contactphone; //联系电话
     ucSelectProject.StorageId = remove.Storageid;
     ucSelectProject.Storagetitle = remove.Storagetitle;
     litProjectcontactorid.Text = remove.Projectcontactorid; // 项目体(分公司)联系人
     litProjectcontactorphone.Text = remove.Projectcontactorphone; //项目体(分公司)联系电话
     if (remove.Planremovedate.HasValue)
     {
         litPlansetupdate.Text = remove.Planremovedate.Value.ToString(UiConst.DateFormat); //计划拆机日期
     }
     if (remove.Approvedate.HasValue)
     {
         litApprovedate.Text = remove.Approvedate.Value.ToString(UiConst.DateTimeFormat);//回复时间
     }
     litApproveuser.Text = remove.Approveuser;//审核人
     if (remove.Confirmdate.HasValue)
     {
         litConfirmdate.Text = remove.Confirmdate.Value.ToString(UiConst.DateTimeFormat);//确认日期
     }
     if(remove.Actualremovedate.HasValue)
     {
         litActualsetupdate.Text = remove.Actualremovedate.Value.ToString(UiConst.DateFormat); //实际拆机日期
     }
     litConfirmuser.Text = remove.Confirmuser;//确认人
     litSetupcontent.Text = remove.Removedcontent;//已拆机明细
     litApproveresult.Text = EnumUtil.RetrieveEnumDescript(remove.Approveresult);//状态
 }
 public Assetremove UpdateAssetremoveByAssetremoveid(Assetremove info)
 {
     try
     {
         Management.BeginTransaction();
         Management.UpdateAssetremoveByAssetremoveid(info);
         Management.Commit();
     }
     catch
     {
         Management.Rollback();
         throw;
     }
     return info;
 }