protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (string.IsNullOrEmpty(Request.QueryString["RoomID"]))
                {
                    Response.End();
                    return;
                }
                int RoomID = int.Parse(Request.QueryString["RoomID"]);

                RoomBasic basic = RoomBasic.GetRoomBasicByRoomID(RoomID);
                if (basic != null)
                {
                    SetInfo(basic);
                }
                var project = Project.GetProject(RoomID);
                if (project != null)
                {
                    this.tbRoomName.Value = project.Name;
                    string[] SortOrderArray = project.DefaultOrder.Split('-');
                    int      SortOrder      = 0;
                    if (SortOrderArray.Length > 0)
                    {
                        int.TryParse(SortOrderArray[SortOrderArray.Length - 1], out SortOrder);
                    }
                    this.tdSortOrder.Value = SortOrder.ToString();
                }
            }
        }
Exemple #2
0
        private void saveroomresource(HttpContext context)
        {
            int     RoomID  = WebUtil.GetIntValue(context, "RoomID");
            Project project = Project.GetProject(RoomID);

            if (project == null)
            {
                WebUtil.WriteJson(context, new { status = false, error = "房间不存在" });
                return;
            }
            RoomBasic basic = RoomBasic.GetRoomBasicByRoomID(RoomID);
            string    list  = context.Request["FieldList"];
            List <Utility.BasicModel> ModelList = JsonConvert.DeserializeObject <List <Utility.BasicModel> >(list);

            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    project.Name = WebUtil.getServerValue(context, "tbRoomName");
                    int SortOrder = WebUtil.getServerIntValue(context, "tdSortOrder");
                    if (!string.IsNullOrEmpty(project.DefaultOrder))
                    {
                        string   NewDefaultOrder = string.Empty;
                        string[] SortOrderArray  = project.DefaultOrder.Split('-');
                        for (int i = 0; i < SortOrderArray.Length; i++)
                        {
                            if (i != SortOrderArray.Length - 1)
                            {
                                NewDefaultOrder += SortOrderArray[i] + "-";
                            }
                            else
                            {
                                NewDefaultOrder += SortOrder.ToString("D3");
                            }
                        }
                        project.DefaultOrder = NewDefaultOrder;
                    }
                    project.Save(helper);
                    if (basic == null)
                    {
                        basic         = new RoomBasic();
                        basic.RoomID  = project.ID;
                        basic.AddTime = DateTime.Now;
                    }
                    basic.BuildingNumber  = WebUtil.getServerValue(context, "tbBuildingNumber");
                    basic.SignDate        = WebUtil.getServerTimeValue(context, "tdSignDate");
                    basic.PaymentTime     = WebUtil.getServerTimeValue(context, "tbPaymentTime");
                    basic.CertificateTime = WebUtil.getServerTimeValue(context, "tdCertificateTime");
                    basic.RoomType        = WebUtil.getServerValue(context, "tbRoomType");
                    basic.IsJingZhuangXiu = WebUtil.getServerIntValue(context, "tdIsJingZhuangXiu");
                    basic.BuildingOutArea = WebUtil.getServerDecimalValue(context, "tdBuildingOutArea");
                    basic.Save(helper);
                    if (ModelList.Count > 0)
                    {
                        foreach (var item in ModelList)
                        {
                            if (item.id <= 0)
                            {
                                continue;
                            }
                            var roombasic_field = RoomBasicField.GetRoomBasicFieldByRoomIDandFieldID(RoomID, item.id, helper);
                            if (roombasic_field == null)
                            {
                                roombasic_field         = new RoomBasicField();
                                roombasic_field.AddTime = DateTime.Now;
                            }
                            roombasic_field.RoomID       = RoomID;
                            roombasic_field.FieldID      = item.id;
                            roombasic_field.FieldContent = item.value;
                            roombasic_field.Save(helper);
                        }
                    }
                    helper.Commit();
                    WebUtil.WriteJson(context, new { status = true });
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    Utility.LogHelper.WriteError("RoomResourceHandler", "命令:saveroomresource", ex);
                    WebUtil.WriteJson(context, new { status = false });
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["RoomID"] != null)
         {
             int.TryParse(Request.QueryString["RoomID"], out RoomID);
         }
         if (Request.QueryString["DefaultRelationID"] != null)
         {
             int.TryParse(Request.QueryString["DefaultRelationID"], out DefaultRelationID);
         }
         if (Request.QueryString["ContractID"] != null)
         {
             int.TryParse(Request.QueryString["ContractID"], out ContractID);
         }
         if (Request.QueryString["PrintID"] != null)
         {
             int.TryParse(Request.QueryString["PrintID"], out PrintID);
         }
         if (PrintID > 0)
         {
             var history_list = ViewRoomFeeHistory.GetViewRoomFeeHistoryListByPrintID(PrintID);
             if (history_list.Length > 0)
             {
                 DefaultRelationID = history_list[0].DefaultChargeManID;
                 RoomID            = history_list[0].RoomID;
                 ContractID        = history_list[0].ContractID;
                 CanPrintCheque    = true;
             }
         }
         Foresight.DataAccess.RoomPhoneRelation data = null;
         RoomBasic basic = null;
         using (SqlHelper helper = new SqlHelper())
         {
             if (DefaultRelationID > 0)
             {
                 data = RoomPhoneRelation.GetRoomPhoneRelation(DefaultRelationID, helper);
             }
             if (data == null)
             {
                 data = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID, helper);
             }
             if (data == null)
             {
                 basic = RoomBasic.GetRoomBasicByRoomID(RoomID, helper);
             }
         }
         if (data != null)
         {
             this.RelationID                  = data.ID;
             this.tdCompanyName.Value         = data.CompanyName;
             this.tdAddress.Value             = data.HomeAddress;
             this.tdBuyerTaxpayerNumber.Value = data.TaxpayerNumber;
             this.tdBuyerBankAccountNo.Value  = data.BankAccountNo;
             this.tdBuyerBankName.Value       = data.BankName;
             this.tdBuyerEmailAddress.Value   = data.EmailAddress;
         }
         if (basic != null)
         {
             this.tdCompanyName.Value         = basic.ChequeCompanyName;
             this.tdAddress.Value             = basic.ChequeAddress;
             this.tdBuyerTaxpayerNumber.Value = basic.ChequeTaxpayerNumber;
             this.tdBuyerBankAccountNo.Value  = basic.ChequeBankNo;
             this.tdBuyerBankName.Value       = basic.ChequeBankName;
             this.tdBuyerEmailAddress.Value   = basic.ChequeEmailAddress;
         }
         var company = Company.GetCompanies().FirstOrDefault();
         if (company != null)
         {
             this.tdSellerCompanyName.Value    = string.IsNullOrEmpty(company.ChequeTitle) ? company.CompanyName : company.ChequeTitle;
             this.tdSellerAddress.Value        = company.Address;
             this.tdSellerTaxpayerNumber.Value = company.TaxpayerNumber;
             this.tdSellerBankNo.Value         = company.BankAccountNo;
             this.tdSellerBankName.Value       = company.BankName;
             this.tdReCheckUserName.Value      = company.ReCheckUserName;
             this.tdCheque_SL.Value            = company.Cheque_SL > decimal.MinValue ? company.Cheque_SL.ToString("0.00") : string.Empty;
             this.tdCheque_FLBM.Value          = company.Cheque_FLBM;
         }
     }
 }