public Assetsetupinfo CreateAssetsetupinfo(Assetsetupinfo info)
 {
     try
     {
         info.Setupid = new CoderuleManagement().GenerateCodeRule(Assetsetupinfo.RuleCode + DateTime.Today.ToString("yyyyMM"), false);
         Management.BeginTransaction();
         Management.CreateAssetsetupinfo(info);
         Management.Commit();
     }
     catch
     {
         Management.Rollback();
         throw;
     }
     return info;
 }
        public Assetsetupinfo CreateAssetsetupinfo(Assetsetupinfo info)
        {
            try
            {
                string sqlCommand = @"INSERT INTO ""ASSETSETUPINFO"" (""SETUPID"",""APPLYSETUPDATE"",""APPLYDATE"",""APPLYUSERID"",""CONTACTPHONE"",""PROJECTCONTACTORID"",""PROJECTCONTACTORPHONE"",""PLANSETUPDATE"",""ACTUALSETUPDATE"",""APPLYCONTENT"",""SUBCOMPANY"",""REJECTREASON"",""APPROVEUSER"",""APPROVEDATE"",""APPROVERESULT"",""CREATEDDATE"",""SUBCOMPANYCONTACTORID"",""CREATOR"",""ASSETCATEGORYID"",""SETUPCONTENT"",""CONFIRMDATE"",""CONFIRMUSER"",""STORAGETITLE"",""STORAGEID"") VALUES (:Setupid,:Applysetupdate,:Applydate,:Applyuserid,:Contactphone,:Projectcontactorid,:Projectcontactorphone,:Plansetupdate,:Actualsetupdate,:Applycontent,:Subcompany,:Rejectreason,:Approveuser,:Approvedate,:Approveresult,:Createddate,:Subcompanycontactorid,:Creator,:Assetcategoryid,:Setupcontent,:Confirmdate,:Confirmuser,:Storagetitle,:Storageid)";
                this.Database.AddInParameter(":Setupid", info.Setupid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Applysetupdate", info.Applysetupdate);//DBType:DATE
                this.Database.AddInParameter(":Applydate", info.Applydate);//DBType:DATE
                this.Database.AddInParameter(":Applyuserid", info.Applyuserid);//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(":Plansetupdate", info.Plansetupdate);//DBType:DATE
                this.Database.AddInParameter(":Actualsetupdate", info.Actualsetupdate);//DBType:DATE
                this.Database.AddInParameter(":Applycontent", info.Applycontent);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Subcompany", info.Subcompany);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Rejectreason", info.Rejectreason);//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(":Createddate", info.Createddate);//DBType:DATE
                this.Database.AddInParameter(":Subcompanycontactorid", info.Subcompanycontactorid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Creator", info.Creator);//DBType:VARCHAR2
                this.Database.AddInParameter(":Assetcategoryid", info.Assetcategoryid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Setupcontent", info.Setupcontent);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Confirmdate", info.Confirmdate);//DBType:DATE
                this.Database.AddInParameter(":Confirmuser", info.Confirmuser);//DBType:VARCHAR2
                this.Database.AddInParameter(":Storagetitle", info.Storagetitle);//DBType:VARCHAR2
                this.Database.AddInParameter(":Storageid", info.Storageid);//DBType:VARCHAR2
                this.Database.ExecuteNonQuery(sqlCommand);

            }
            finally
            {
                this.Database.ClearParameter();
            }
            return info;
        }
 protected void BindData(Assetsetupinfo SetupInfo)
 {
     //bind setup
     litSetupid.Text = SetupInfo.Setupid;//申请单号
     ucSeletedSystem.Assetcategoryid = SetupInfo.Assetcategoryid; //所属系统
     if (SetupInfo.Applysetupdate.HasValue)
     {
         litApplysetupdate.Text = SetupInfo.Applysetupdate.Value.ToString(UiConst.DateFormat); //申请安装日期
     }
     if (SetupInfo.Applydate.HasValue)
     {
         litApplyDate.Text = SetupInfo.Applydate.Value.ToString(UiConst.DateFormat);  //申请日期
     }
     litApplycontent.Text = SetupInfo.Applycontent;//申请内容
     ucApplyuser.UserId = SetupInfo.Applyuserid;//申请人
     litContactphone.Text = SetupInfo.Contactphone; //联系电话
     ucSelectProject.StorageId = SetupInfo.Storageid;
     ucSelectProject.Storagetitle = SetupInfo.Storagetitle;
     litProjectcontactorid.Text = SetupInfo.Projectcontactorid; // 项目体(分公司)联系人
     litProjectcontactorphone.Text = SetupInfo.Projectcontactorphone; //项目体(分公司)联系电话
     if (SetupInfo.Plansetupdate.HasValue)
     {
         litPlansetupdate.Text = SetupInfo.Plansetupdate.Value.ToString(UiConst.DateFormat); //计划安装日期
     }
     if (SetupInfo.Approvedate.HasValue)
     {
         litApprovedate.Text = SetupInfo.Approvedate.Value.ToString(UiConst.DateTimeFormat);//回复时间
     }
     litApproveuser.Text = SetupInfo.Approveuser;//审核人
     if (SetupInfo.Confirmdate.HasValue)
     {
         litConfirmdate.Text = SetupInfo.Confirmdate.Value.ToString(UiConst.DateTimeFormat);//确认日期
     }
     litConfirmuser.Text = SetupInfo.Confirmuser;//确认人
     litSetupcontent.Text = SetupInfo.Setupcontent;//已安装明细
     litApproveresult.Text = EnumUtil.RetrieveEnumDescript(SetupInfo.Approveresult);//状态
 }
 public Assetsetupinfo UpdateAssetsetupinfoBySetupid(Assetsetupinfo info)
 {
     try
     {
         Management.BeginTransaction();
         Management.UpdateAssetsetupinfoBySetupid(info);
         Management.Commit();
     }
     catch
     {
         Management.Rollback();
         throw;
     }
     return info;
 }
 protected void BindData(Assetsetupinfo SetupInfo)
 {
     //bind setup
     litSetupid.Text = SetupInfo.Setupid;//申请单号
     ucSeletedSystem.Assetcategoryid = SetupInfo.Assetcategoryid;
     ucApplySetupDate.DateValue = SetupInfo.Applysetupdate;
     ucApplyDate.DateValue = SetupInfo.Applydate;
     txtApplycontent.Text = SetupInfo.Applycontent;//申请内容
     ucApplyuser.UserId = SetupInfo.Applyuserid;
     txtContactphone.Text = SetupInfo.Contactphone; //联系电话
     ucSelectProject.StorageId = SetupInfo.Storageid;
     ucSelectProject.Storagetitle = SetupInfo.Storagetitle;
     txtProjectcontactorid.Text = SetupInfo.Projectcontactorid; // 项目体(分公司)联系人
     txtProjectcontactorphone.Text = SetupInfo.Projectcontactorphone; //项目体(分公司)联系电话
 }
 protected void SaveData(SetupState setupState)
 {
     Assetsetupinfo SetupInfo = null;
     if (!string.IsNullOrEmpty(PageUtility.GetQueryStringValue("Setupid"))) //修改
     {
         SetupInfo = AssetsetupinfoService.RetrieveAssetsetupinfoBySetupid(Setupid);
         if (SetupInfo==null){return;}
         ExtractData(SetupInfo);
         SetupInfo.Approveresult = setupState;
         AssetsetupinfoService.UpdateAssetsetupinfoBySetupid(SetupInfo);
         foreach (Assetsetupdetail assetsetupdetail in SetupDetail)
         {
             assetsetupdetail.Setupid = SetupInfo.Setupid;
             if (AssetsetupdetailService.RetrieveAssetsetupdetailByDetailid(assetsetupdetail.Detailid) == null)
             {
                 AssetsetupdetailService.CreateAssetsetupdetail(assetsetupdetail);
             }
             else
             {
                 AssetsetupdetailService.UpdateAssetsetupdetailByDetailid(assetsetupdetail);
             }
         }
     }
     else //新增
     {
         SetupInfo=new Assetsetupinfo();
         ExtractData(SetupInfo);
         SetupInfo.Approveresult = setupState;
         AssetsetupinfoService.CreateAssetsetupinfo(SetupInfo);
         foreach (Assetsetupdetail assetsetupdetail in SetupDetail)
         {
             assetsetupdetail.Setupid = SetupInfo.Setupid;
             AssetsetupdetailService.CreateAssetsetupdetail(assetsetupdetail);
         }
     }
 }
 protected void ExtractData(Assetsetupinfo assetsetupinfo)
 {
     assetsetupinfo.Setupid = Setupid;//申请单号
     assetsetupinfo.Assetcategoryid = ucSeletedSystem.Assetcategoryid;//(系统)设备大类
     assetsetupinfo.Applysetupdate = ucApplySetupDate.DateValue;//申请安装日期
     assetsetupinfo.Applycontent = txtApplycontent.Text;//申请内容
     assetsetupinfo.Applydate = ucApplyDate.DateValue;//申请日期
     assetsetupinfo.Applyuserid = ucApplyuser.UserId;//申请人
     assetsetupinfo.Storagetitle = ucSelectProject.Storagetitle;//区分字段:分公司或项目体
     assetsetupinfo.Storageid = ucSelectProject.StorageId;//项目体ID或分公司ID
     assetsetupinfo.Contactphone = txtContactphone.Text;//联系电话
     assetsetupinfo.Projectcontactorid = txtProjectcontactorid.Text.Trim();//项目体联系人
     assetsetupinfo.Projectcontactorphone = txtProjectcontactorphone.Text;//项目体联系电话
     assetsetupinfo.Createddate = DateTime.Now;//创建日期
     assetsetupinfo.Creator = WebContext.Current.CurrentUser.Id;//创建人
 }
 protected void BindData(Assetsetupinfo SetupInfo)
 {
     //bind setup
     litSetupid.Text = SetupInfo.Setupid;//申请单号
     ucSeletedSystem.Assetcategoryid = SetupInfo.Assetcategoryid; //所属系统
     if (SetupInfo.Applysetupdate.HasValue)
     {
         litApplysetupdate.Text = SetupInfo.Applysetupdate.Value.ToString(UiConst.DateFormat); //申请安装日期
     }
     if (SetupInfo.Applydate.HasValue)
     {
         litApplyDate.Text = SetupInfo.Applydate.Value.ToString(UiConst.DateFormat);  //申请日期
     }
     litApplycontent.Text = SetupInfo.Applycontent;//申请内容
     ucApplyuser.UserId = SetupInfo.Applyuserid;
     litContactphone.Text = SetupInfo.Contactphone; //联系电话
     ucSelectProject.StorageId = SetupInfo.Storageid;
     ucSelectProject.Storagetitle = SetupInfo.Storagetitle;
     litProjectcontactorid.Text = SetupInfo.Projectcontactorid; // 项目体(分公司)联系人
     litProjectcontactorphone.Text = SetupInfo.Projectcontactorphone; //项目体(分公司)联系电话
 }