private void SetInfo(Foresight.DataAccess.Contract data)
 {
     this.tdRentName.Value        = data.RentName;
     this.tdContractPhone.Value   = data.ContractPhone;
     this.tdContractNo.Value      = data.ContractNo;
     this.tdContractName.Value    = data.ContractName;
     this.tdContractDeposit.Value = data.ContractDeposit > decimal.MinValue ? data.ContractDeposit.ToString() : "";
     this.tdTimeLimit.Value       = data.TimeLimit > int.MinValue ? data.TimeLimit.ToString() : "";
     this.tdRentStartTime.Value   = data.RentStartTime > DateTime.MinValue ? data.RentStartTime.ToString("yyyy-MM-dd") : "";
     this.tdRentEndTime.Value     = data.RentEndTime > DateTime.MinValue ? data.RentEndTime.ToString("yyyy-MM-dd") : "";
     this.tdFreeDays.Value        = data.FreeDays > int.MinValue ? data.FreeDays.ToString() : "";
     this.tdRentPrice.Value       = data.RentPrice > decimal.MinValue ? data.RentPrice.ToString() : "";
     this.tdContractSummary.Value = data.ContractSummary;
     //this.tdWarningTime.Value = data.WarningTime > DateTime.MinValue ? data.WarningTime.ToString("yyyy-MM-dd") : "";
     //this.tdContractStatus.Value = data.ContractStatusDesc;
     if (this.canNewRent)
     {
         this.tdRentStartTime.Value = data.RentEndTime > DateTime.MinValue ? data.RentEndTime.AddDays(1).ToString("yyyy-MM-dd") : "";
         this.tdRentEndTime.Value   = "";
         int    TopContractID = data.ID;
         string ContractNo    = data.ContractNo;
         if (data.TopContractID > 0)
         {
             var topContract = Foresight.DataAccess.Contract.GetContract(data.TopContractID);
             if (topContract != null)
             {
                 TopContractID = topContract.ID;
                 ContractNo    = topContract.ContractNo;
             }
         }
         int total = Foresight.DataAccess.Contract.GetRelatedContractCountByID(TopContractID, 1);
         this.tdContractNo.Value = ContractNo + "(续" + (total + 1).ToString() + ")";
     }
 }
 private void SetInfo(Foresight.DataAccess.Contract data)
 {
     this.tdRoomUseFor.Value      = data.RoomUseFor;
     this.tdRoomStatus.Value      = data.RoomStatus;
     this.tdSignTime.Value        = data.SignTime > DateTime.MinValue ? data.SignTime.ToString("yyyy-MM-dd") : "";
     this.tdFreeStartTime.Value   = data.FreeStartTime > DateTime.MinValue ? data.FreeStartTime.ToString("yyyy-MM-dd") : "";
     this.tdFreeEndTime.Value     = data.FreeEndTime > DateTime.MinValue ? data.FreeEndTime.ToString("yyyy-MM-dd") : "";
     this.tdOpenTime.Value        = data.OpenTime > DateTime.MinValue ? data.OpenTime.ToString("yyyy-MM-dd") : "";
     this.tdInTime.Value          = data.InTime > DateTime.MinValue ? data.InTime.ToString("yyyy-MM-dd") : "";
     this.tdOutTime.Value         = data.OutTime > DateTime.MinValue ? data.OutTime.ToString("yyyy-MM-dd") : "";
     this.tdRentRange.Value       = data.RentRange;
     this.tdChargeRange.Value     = data.ChargeRange;
     this.tdSellerProduct.Value   = data.SellerProduct;
     this.tdEveryYearUp.Value     = data.EveryYearUp > decimal.MinValue ? data.EveryYearUp.ToString() : "";
     this.tdBrandModel.Value      = data.BrandModel;
     this.tdPhoneNumber.Value     = data.PhoneNumber;
     this.tdAddress.Value         = data.Address;
     this.tdCustomerName.Value    = data.CustomerName;
     this.tdIDCardNo.Value        = data.IDCardNo;
     this.tdDeliverTime.Value     = data.DeliverTime > DateTime.MinValue ? data.DeliverTime.ToString("yyyy-MM-dd HH:mm:ss") : "";
     this.tdIDCardAddress.Value   = data.IDCardAddress;
     this.tdRentUseFor.Value      = data.RentUseFor;
     this.tdBusinessLicense.Value = data.BusinessLicense;
     this.tdInChargeMan.Value     = data.InChargeMan;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         op   = !string.IsNullOrEmpty(Request.QueryString["op"]) ? Request.QueryString["op"] : string.Empty;
         guid = System.Guid.NewGuid().ToString();
         int ContractID = 0;
         int.TryParse(Request.QueryString["ID"], out ContractID);
         contract = Foresight.DataAccess.Contract.GetContract(ContractID);
         if (contract != null)
         {
             var list = Contract_Room.GetContract_RoomListByContractID(contract.ID);
             SetInfo(contract);
             approve = Foresight.DataAccess.Contract_Approve.GetContract_ApproveByContractID(contract.ID);
             stop    = Foresight.DataAccess.Contract_Stop.GetContract_StopByContractID(contract.ID);
         }
         if (contract == null || contract.ContractStatus.Equals("yuding") || this.op.Equals("edit"))
         {
             canEdit = true;
         }
         if (this.op.Equals("edit"))
         {
             cansavelog = true;
         }
         if (contract != null)
         {
             canprint = true;
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         op = !string.IsNullOrEmpty(Request.QueryString["op"]) ? Request.QueryString["op"] : string.Empty;
         int.TryParse(Request.QueryString["ID"], out ContractID);
         if (this.op.Equals("edit") || this.op.Equals("newrent"))
         {
             canEdit = true;
         }
         if (this.op.Equals("newrent"))
         {
             canNewRent = true;
         }
         if (this.op.Equals("changerent"))
         {
             canChangeRent = true;
         }
         Foresight.DataAccess.Contract contract = null;
         if (ContractID > 0)
         {
             contract = Foresight.DataAccess.Contract.GetContract(ContractID);
         }
         if (contract == null)
         {
             canEdit = true;
             int OrderNumberID = 0;
             this.tdContractNo.Value    = Foresight.DataAccess.Contract.GetLastestContractNumber("", 0, out OrderNumberID);
             this.hdOrderNumberID.Value = OrderNumberID.ToString();
         }
         else
         {
             SetInfo(contract);
             if (contract.ContractStatus.Equals("yuding"))
             {
                 canEdit = true;
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         op = !string.IsNullOrEmpty(Request.QueryString["op"]) ? Request.QueryString["op"] : string.Empty;
         int.TryParse(Request.QueryString["ID"], out ContractID);
         if (this.op.Equals("edit") || this.op.Equals("newrent"))
         {
             canEdit = true;
         }
         contract = Foresight.DataAccess.Contract.GetContract(ContractID);
         if (contract == null)
         {
             canEdit = true;
         }
         else
         {
             if (contract.ContractStatus.Equals("yuding"))
             {
                 canEdit = true;
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         op   = !string.IsNullOrEmpty(Request.QueryString["op"]) ? Request.QueryString["op"] : string.Empty;
         guid = System.Guid.NewGuid().ToString();
         int.TryParse(Request.QueryString["ID"], out ContractID);
         if (this.op.Equals("add"))
         {
             canAdd = true;
         }
         if (this.op.Equals("edit") || this.op.Equals("newrent"))
         {
             canEdit = true;
         }
         contract = Foresight.DataAccess.Contract.GetContract(ContractID);
         if (contract == null)
         {
             canEdit = true;
         }
         else
         {
             canprint = true;
             if (contract.ContractStatus.Equals("yuding"))
             {
                 canEdit = true;
             }
             if (this.op.Equals("rent"))
             {
                 canRent    = true;
                 cansavelog = true;
             }
             if (this.op.Equals("edit"))
             {
                 cansavelog = true;
             }
             if (this.op.Equals("view"))
             {
                 canView = true;
             }
             if (this.op.Equals("newrent"))
             {
                 canNewRent = true;
                 cansavelog = true;
                 canprint   = false;
                 canAdd     = true;
             }
             SetInfo(contract);
             if (!canNewRent)
             {
                 approve = Foresight.DataAccess.Contract_Approve.GetContract_ApproveByContractID(contract.ID);
                 stop    = Foresight.DataAccess.Contract_Stop.GetContract_StopByContractID(contract.ID);
             }
             else
             {
                 int.TryParse(Request.QueryString["ID"], out TopContractID);
                 ContractID = 0;
                 var contractRoomList = Contract_Room.GetContract_RoomListByContractID(contract.ID);
                 using (SqlHelper helper = new SqlHelper())
                 {
                     try
                     {
                         helper.BeginTransaction();
                         foreach (var item in contractRoomList)
                         {
                             var data = new Contract_Room
                             {
                                 ContractID   = 0,
                                 GUID         = guid,
                                 ChargeID     = item.ChargeID,
                                 RoomID       = item.RoomID,
                                 RentName     = item.RentName,
                                 RoomLocation = item.RoomLocation,
                                 RoomArea     = item.RoomArea
                             };
                             data.Save(helper);
                         }
                         helper.Commit();
                     }
                     catch (Exception)
                     {
                         helper.Rollback();
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 private void SetInfo(Foresight.DataAccess.Contract data)
 {
     this.FinalContractID = ContractID;
     if (this.canNewRent || this.canChangeRent)
     {
         this.ContractID    = 0;
         this.TopContractID = data.ID;
         if (data.TopContractID > 0)
         {
             var topContract = Foresight.DataAccess.Contract.GetContract(data.TopContractID);
             if (topContract != null)
             {
                 TopContractID = topContract.ID;
             }
         }
         //资源列表
         var contractRoomList = Contract_Room.GetContract_RoomListByContractID(TopContractID);
         //收费标准
         var chargeList = Contract_ChargeSummary.GetContract_ChargeSummaryList(TopContractID, string.Empty, 0);
         using (SqlHelper helper = new SqlHelper())
         {
             try
             {
                 helper.BeginTransaction();
                 foreach (var item in contractRoomList)
                 {
                     var dataItem = new Contract_Room
                     {
                         ContractID   = 0,
                         GUID         = guid,
                         ChargeID     = item.ChargeID,
                         RoomID       = item.RoomID,
                         RentName     = item.RentName,
                         RoomLocation = item.RoomLocation,
                         RoomArea     = item.RoomArea
                     };
                     dataItem.Save(helper);
                 }
                 foreach (var item in chargeList)
                 {
                     var dataItem = new Contract_ChargeSummary
                     {
                         ContractID = 0,
                         GUID       = guid,
                         ChargeID   = item.ChargeID,
                         RoomType   = item.RoomType,
                     };
                     dataItem.Save(helper);
                 }
                 helper.Commit();
             }
             catch (Exception)
             {
                 helper.Rollback();
             }
         }
         if (this.canChangeRent)
         {
             //免租期
             var freeList = Contract_FreeTime.GetContract_FreeTimeList(TopContractID);
             //收费标准
             var contractChargeList = ViewContractChargeSummary.GetViewContractChargeSummaryByContractID(TopContractID).Where(p => p.CalcualteRestCost > 0); //Contract_RoomCharge.GetContract_RoomChargeListByContractID(TopContractID);
             using (SqlHelper helper = new SqlHelper())
             {
                 try
                 {
                     helper.BeginTransaction();
                     foreach (var item in contractChargeList)
                     {
                         var dataItem = new Contract_RoomCharge
                         {
                             ContractID           = 0,
                             GUID                 = guid,
                             ChargeID             = item.ChargeID,
                             RoomID               = item.RoomID,
                             RoomUnitPrice        = item.RoomUnitPrice,
                             RoomStartTime        = item.RoomStartTime,
                             RoomEndTime          = item.RoomEndTime,
                             RoomNewEndTime       = item.RoomNewEndTime,
                             RoomCost             = item.RoomCost,
                             Remark               = item.Remark,
                             AddTime              = DateTime.Now,
                             RoomUseCount         = item.RoomUseCount,
                             ReadyChargeTime      = item.ReadyChargeTime,
                             Contract_TempPriceID = item.Contract_TempPriceID,
                             IsReRent             = item.IsReRent,
                             IsContractDivideFee  = item.IsContractDivideFee
                         };
                         dataItem.Save(helper);
                     }
                     helper.Commit();
                 }
                 catch (Exception)
                 {
                     helper.Rollback();
                 }
             }
         }
     }
 }
Ejemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         op   = !string.IsNullOrEmpty(Request.QueryString["op"]) ? Request.QueryString["op"] : string.Empty;
         guid = Request.QueryString["guid"];
         if (string.IsNullOrEmpty(guid))
         {
             guid = System.Guid.NewGuid().ToString();
         }
         int.TryParse(Request.QueryString["ID"], out ContractID);
         if (this.op.Equals("add"))
         {
             canAdd = true;
         }
         if (this.op.Equals("edit") || this.op.Equals("newrent") || this.op.Equals("changerent"))
         {
             canEdit = true;
         }
         contract = Foresight.DataAccess.Contract.GetContract(ContractID);
         if (contract == null)
         {
             canEdit    = true;
             ContractID = 0;
         }
         else
         {
             canPrint = true;
             if (contract.ContractStatus.Equals("yuding"))
             {
                 canEdit = true;
             }
             if (this.op.Equals("rent"))
             {
                 canRent    = true;
                 canSaveLog = true;
             }
             if (this.op.Equals("changerent"))
             {
                 canChangeRent = true;
                 canSaveLog    = true;
             }
             if (this.op.Equals("edit"))
             {
                 canSaveLog = true;
             }
             if (this.op.Equals("view"))
             {
                 canView = true;
             }
             if (this.op.Equals("newrent"))
             {
                 canNewRent = true;
                 canSaveLog = true;
                 canPrint   = false;
                 canAdd     = true;
             }
             SetInfo(contract);
         }
     }
 }
        private void SetInfo(Foresight.DataAccess.Contract data)
        {
            this.tdContractType.Value  = data.ContractType > 0 ? data.ContractType.ToString() : "1";
            this.tdContractName.Value  = data.ContractName;
            this.tdContractNo.Value    = data.ContractNo;
            this.tdTimeLimit.Value     = data.TimeLimit > int.MinValue ? data.TimeLimit.ToString() : "";
            this.tdRentStartTime.Value = data.RentStartTime > DateTime.MinValue ? data.RentStartTime.ToString("yyyy-MM-dd") : "";
            this.tdRentEndTime.Value   = data.RentEndTime > DateTime.MinValue ? data.RentEndTime.ToString("yyyy-MM-dd") : "";
            this.tdTimeLimit.Value     = data.TimeLimit > int.MinValue ? data.TimeLimit.ToString() : "";
            //this.tdContractStatus.Value = data.ContractStatusDesc;
            //this.tdWarningTime.Value = data.WarningTime > DateTime.MinValue ? data.WarningTime.ToString("yyyy-MM-dd") : "";
            this.tdIsContractDivideOn.Checked  = data.IsDivideOn;
            this.tdContractDevicePercent.Value = data.ContractDevicePercent > 0 ? data.ContractDevicePercent.ToString() : "";
            this.tdContractBasicRentCost.Value = data.ContractBasicRentCost > 0 ? data.ContractBasicRentCost.ToString() : "";
            if (this.canNewRent || canChangeRent)
            {
                this.ContractID = 0;
                int    TopContractID = data.ID;
                string ContractNo    = data.ContractNo;
                if (data.TopContractID > 0)
                {
                    var topContract = Foresight.DataAccess.Contract.GetContract(data.TopContractID);
                    if (topContract != null)
                    {
                        TopContractID = topContract.ID;
                        ContractNo    = topContract.ContractNo;
                    }
                }
                if (canNewRent)
                {
                    this.tdRentStartTime.Value = data.RentEndTime > DateTime.MinValue ? data.RentEndTime.AddDays(1).ToString("yyyy-MM-dd") : "";
                    this.tdRentEndTime.Value   = "";
                    int total = Foresight.DataAccess.Contract.GetRelatedContractCountByID(TopContractID, 1);
                    this.tdContractNo.Value = ContractNo + "(续" + (total + 1).ToString() + ")";
                }
                else if (canChangeRent)
                {
                    int total = Foresight.DataAccess.Contract.GetRelatedContractCountByID(TopContractID, 2);
                    this.tdContractNo.Value = ContractNo + "(转" + (total + 1).ToString() + ")";
                }
            }
            var relationPhone = RoomPhoneRelation.GetRoomPhoneRelation(data.RelationPhoneID);

            if (canChangeRent)
            {
                if (relationPhone != null)
                {
                    this.oldRelationProperty.InnerHtml = relationPhone.RelationPropertyDesc;
                    this.hdOldRelationProperty.Value   = relationPhone.RelationProperty;
                    if (relationPhone.RelationProperty.Equals("geren"))
                    {
                        this.oldRentName.InnerHtml = relationPhone.RelationName;
                    }
                    else
                    {
                        this.oldRentName.InnerHtml     = relationPhone.CompanyName;
                        this.oldCustomerName.InnerHtml = relationPhone.RelationName;
                    }
                    this.oldContractPhone.InnerHtml   = relationPhone.RelatePhoneNumber;
                    this.oldIDCardType.InnerHtml      = relationPhone.IDCardTypeDesc;
                    this.oldIDCardNo.InnerHtml        = relationPhone.RelationIDCard;
                    this.oldIDCardAddress.InnerHtml   = relationPhone.IDCardAddress;
                    this.oldInChargeMan.InnerHtml     = relationPhone.CompanyInChargeMan;
                    this.oldBusinessLicense.InnerHtml = relationPhone.BusinessLicense;
                    this.oldSellerProduct.InnerHtml   = relationPhone.SellerProduct;
                }
                else
                {
                    this.oldRelationProperty.InnerHtml = "个人";
                    this.hdOldRelationProperty.Value   = "geren";
                    this.oldRentName.InnerHtml         = data.RentName;
                    this.oldContractPhone.InnerHtml    = data.ContractPhone;
                    this.oldCustomerName.InnerHtml     = data.RentName;
                    this.oldIDCardType.InnerHtml       = "";
                    this.oldIDCardNo.InnerHtml         = data.IDCardNo;
                    this.oldIDCardAddress.InnerHtml    = data.IDCardAddress;
                    this.oldInChargeMan.InnerHtml      = data.InChargeMan;
                    this.oldBusinessLicense.InnerHtml  = data.BusinessLicense;
                    this.oldSellerProduct.InnerHtml    = data.SellerProduct;
                }
            }
            else
            {
                if (relationPhone != null)
                {
                    this.tdRelationProperty.Value = relationPhone.RelationProperty;
                    if (relationPhone.RelationProperty.Equals("geren"))
                    {
                        this.tdRentName.Value = relationPhone.RelationName;
                    }
                    else
                    {
                        this.tdRentName.Value     = relationPhone.CompanyName;
                        this.tdCustomerName.Value = relationPhone.RelationName;
                    }
                    this.tdContractPhone.Value   = relationPhone.RelatePhoneNumber;
                    this.tdIDCardType.Value      = relationPhone.IDCardType == int.MinValue ? "1" : relationPhone.IDCardType.ToString();
                    this.tdIDCardNo.Value        = relationPhone.RelationIDCard;
                    this.tdIDCardAddress.Value   = relationPhone.IDCardAddress;
                    this.tdInChargeMan.Value     = relationPhone.CompanyInChargeMan;
                    this.tdBusinessLicense.Value = relationPhone.BusinessLicense;
                    this.tdSellerProduct.Value   = relationPhone.SellerProduct;
                }
                else
                {
                    this.tdRelationProperty.Value = "geren";
                    this.tdRentName.Value         = data.RentName;
                    this.tdContractPhone.Value    = data.ContractPhone;
                    this.tdCustomerName.Value     = data.RentName;
                    this.tdIDCardType.Value       = "1";
                    this.tdIDCardNo.Value         = data.IDCardNo;
                    this.tdIDCardAddress.Value    = data.IDCardAddress;
                    this.tdInChargeMan.Value      = data.InChargeMan;
                    this.tdBusinessLicense.Value  = data.BusinessLicense;
                    this.tdSellerProduct.Value    = data.SellerProduct;
                }
            }
        }