private void SetInfo(RoomBasic data)
 {
     this.tbRoomState.Value           = data.RoomStateID > 0 ? data.RoomStateID.ToString() : "";
     this.tdBuildingArea.Value        = data.BuildingArea == decimal.MinValue ? "" : data.BuildingArea.ToString();
     this.tdContractArea.Value        = data.ContractArea == decimal.MinValue ? "" : data.ContractArea.ToString();
     this.tbPaymentTime.Value         = data.PaymentTime == DateTime.MinValue ? "" : data.PaymentTime.ToString("yyyy-MM-dd");
     this.tdMoveInTime.Value          = data.MoveInTime == DateTime.MinValue ? "" : data.MoveInTime.ToString("yyyy-MM-dd");
     this.tdZxStartTime.Value         = data.ZxStartTime == DateTime.MinValue ? "" : data.ZxStartTime.ToString("yyyy-MM-dd");
     this.tdZxEndTime.Value           = data.ZxEndTime == DateTime.MinValue ? "" : data.ZxEndTime.ToString("yyyy-MM-dd");
     this.tdRoomLayout.Value          = data.RoomLayout;
     this.tbBuildingNumber.Value      = data.BuildingNumber;
     this.tdBuildOutArea.Value        = data.BuildOutArea == decimal.MinValue ? "" : data.BuildOutArea.ToString();
     this.tdBuildInArea.Value         = data.BuildInArea == decimal.MinValue ? "" : data.BuildInArea.ToString();
     this.tdGonTanArea.Value          = data.GonTanArea == decimal.MinValue ? "" : data.GonTanArea.ToString();
     this.tdChanQuanArea.Value        = data.ChanQuanArea == decimal.MinValue ? "" : data.ChanQuanArea.ToString();
     this.tdUseArea.Value             = data.UseArea == decimal.MinValue ? "" : data.UseArea.ToString();
     this.tdPeiTaoArea.Value          = data.PeiTaoArea == decimal.MinValue ? "" : data.PeiTaoArea.ToString();
     this.tdFunctionCoefficient.Value = data.FunctionCoefficient == decimal.MinValue ? "" : data.FunctionCoefficient.ToString();
     this.tdFenTanCoefficient.Value   = data.FenTanCoefficient == decimal.MinValue ? "" : data.FenTanCoefficient.ToString();
     this.tdChanQuanNo.Value          = data.ChanQuanNo;
     this.tdCertificateTime.Value     = data.CertificateTime == DateTime.MinValue ? "" : data.CertificateTime.ToString("yyyy-MM-dd");
     this.tbRoomProperty.Value        = data.RoomPropertyID > 0 ? data.RoomPropertyID.ToString() : "";
     this.tbRoomType.Value            = data.RoomTypeID > 0 ? data.RoomTypeID.ToString() : "";
     this.tdCustomOne.Value           = data.CustomOne;
     this.tdCustomTwo.Value           = data.CustomTwo;
     this.tdCustomThree.Value         = data.CustomThree;
     this.tdCustomFour.Value          = data.CustomFour;
     this.hdRemark.Value   = data.Remark;
     this.tdIsLocked.Value = data.IsLocked ? "1" : "0";
 }
        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 #3
0
 private void SetInfo(RoomBasic data)
 {
     if (data.RoomID > 0)
     {
     }
     this.tbBuildingNumber.Value  = data.BuildingNumber;
     this.tdSignDate.Value        = WebUtil.GetStrDate(data.SignDate);
     this.tbPaymentTime.Value     = WebUtil.GetStrDate(data.PaymentTime);
     this.tdCertificateTime.Value = WebUtil.GetStrDate(data.CertificateTime);
     this.tbRoomType.Value        = data.RoomType;
     this.tdIsJingZhuangXiu.Value = data.IsJingZhuangXiu > 0 ? data.IsJingZhuangXiu.ToString() : "";
     this.tdBuildingOutArea.Value = data.BuildingOutArea > 0 ? data.BuildingOutArea.ToString() : "";
 }
Exemple #4
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;
         }
     }
 }
Exemple #6
0
        private void importroomsource(HttpContext context)
        {
            HttpFileCollection uploadFiles = context.Request.Files;

            if (uploadFiles.Count == 0)
            {
                context.Response.Write("请选择一个文件");
                return;
            }
            if (string.IsNullOrEmpty(uploadFiles[0].FileName))
            {
                context.Response.Write("请选择一个文件");
                return;
            }
            HttpPostedFile postedFile = uploadFiles[0];
            string         filepath   = HttpContext.Current.Server.MapPath("~/upload/ImportRoomSource/" + DateTime.Now.ToString("yyyyMMdd"));

            if (!System.IO.Directory.Exists(filepath))
            {
                System.IO.Directory.CreateDirectory(filepath);
            }
            string filename = DateTime.Now.ToLocalTime().ToString("yyyyMMddHHmmss") + "_" + postedFile.FileName;
            string fullpath = Path.Combine(filepath, filename);

            postedFile.SaveAs(fullpath);
            string    msg   = string.Empty;
            DataTable table = ExcelExportHelper.NPOIReadExcel(fullpath);

            if (!table.Columns.Contains("资源ID"))
            {
                msg += "<p>导入失败,原因:资源ID列不存在</p>";
                WebUtil.WriteJson(context, msg);
                return;
            }
            int MinID = table.Select().Min(r =>
            {
                int ID = 0;
                if (r.Field <object>("资源ID") != null)
                {
                    int.TryParse(r.Field <object>("资源ID").ToString(), out ID);
                }
                return(ID);
            });
            int MaxID = table.Select().Max(r =>
            {
                int ID = 0;
                if (r.Field <object>("资源ID") != null)
                {
                    int.TryParse(r.Field <object>("资源ID").ToString(), out ID);
                }
                return(ID);
            });
            string TableName          = Utility.EnumModel.DefineFieldTableName.RoomBasic.ToString();
            string TableName_Relation = Utility.EnumModel.DefineFieldTableName.RoomPhoneRelation.ToString();
            string isconver           = context.Request["isconver"];
            bool   ImportFailed       = false;
            int    count       = 0;
            var    comm_helper = new APPCode.CommHelper();

            titleList = GetTableColumns();
            var basicList = RoomBasic.GetRoomBasicListByMinMaxRoomID(MinID, MaxID);
            var phoneList = RoomPhoneRelation.GetRoomPhoneRelationListByMinMaxRoomID(MinID, MaxID);

            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    #region 导入处理
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        count = i;
                        Project project = null;
                        object  Value   = table.Rows[i]["资源ID"];
                        int     RoomID  = 0;
                        if (Value != null)
                        {
                            int.TryParse(Value.ToString(), out RoomID);
                        }
                        if (RoomID > 0)
                        {
                            project = Foresight.DataAccess.Project.GetProject(RoomID, helper);
                        }
                        if (project == null)
                        {
                            msg         += "<p>第" + (i + 2) + "行上传失败。原因:所属项目不存在</p>";
                            ImportFailed = true;
                            break;
                        }
                        if (GetColumnValue("房号", table, i, out Value))
                        {
                            project.Name = Value.ToString().Trim();
                        }
                        project.Save(helper);
                        RoomBasic basic = basicList.FirstOrDefault(p => p.RoomID == project.ID);
                        if (isconver.Equals("0") && basic != null)
                        {
                            continue;
                        }
                        if (basic == null)
                        {
                            basic         = new RoomBasic();
                            basic.RoomID  = project.ID;
                            basic.AddTime = DateTime.Now;
                        }
                        if (GetColumnValue("期数", table, i, out Value))
                        {
                            basic.BuildingNumber = Value.ToString().Trim();
                        }
                        if (GetColumnValue("签约日期", table, i, out Value))
                        {
                            basic.SignDate = GetDateTimeValue(Value);
                        }
                        if (GetColumnValue("交付时间", table, i, out Value))
                        {
                            basic.PaymentTime = GetDateTimeValue(Value);
                        }
                        if (GetColumnValue("产权办理时间", table, i, out Value))
                        {
                            basic.CertificateTime = GetDateTimeValue(Value);
                        }
                        if (GetColumnValue("房产类别", table, i, out Value))
                        {
                            basic.RoomType = Value.ToString().Trim();
                        }
                        if (GetColumnValue("精装修情况", table, i, out Value))
                        {
                            basic.IsJingZhuangXiu = 0;
                            if (Value.ToString().Trim().Equals("是"))
                            {
                                basic.IsJingZhuangXiu = 1;
                            }
                            if (Value.ToString().Trim().Equals("否"))
                            {
                                basic.IsJingZhuangXiu = 2;
                            }
                        }
                        if (GetColumnValue("建筑面积", table, i, out Value))
                        {
                            basic.BuildingOutArea = GetDecimalValue(Value);
                        }
                        List <RoomPhoneRelation> roomPhoneRelationList = new List <RoomPhoneRelation>();
                        string phoneName = string.Empty;
                        if (GetColumnValue("业主1", table, i, out Value))
                        {
                            phoneName = Value.ToString().Trim();
                        }
                        if (!string.IsNullOrEmpty(phoneName))
                        {
                            var myPhoneRelation = phoneList.FirstOrDefault(p => p.RoomID == basic.RoomID && p.RelationName.Equals(phoneName));
                            if (myPhoneRelation == null)
                            {
                                myPhoneRelation         = new RoomPhoneRelation();
                                myPhoneRelation.AddTime = DateTime.Now;
                                myPhoneRelation.RoomID  = basic.RoomID;
                            }
                            myPhoneRelation.RelationType = "homefamily";
                            myPhoneRelation.RelationName = phoneName;
                            if (GetColumnValue("业主1联系方式", table, i, out Value))
                            {
                                myPhoneRelation.RelatePhoneNumber = Value.ToString().Trim();
                            }
                            myPhoneRelation.Save(helper);
                        }
                        phoneName = string.Empty;
                        if (GetColumnValue("业主2", table, i, out Value))
                        {
                            phoneName = Value.ToString().Trim();
                        }
                        if (!string.IsNullOrEmpty(phoneName))
                        {
                            var myPhoneRelation = phoneList.FirstOrDefault(p => p.RoomID == basic.RoomID && p.RelationName.Equals(phoneName));
                            if (myPhoneRelation == null)
                            {
                                myPhoneRelation         = new RoomPhoneRelation();
                                myPhoneRelation.AddTime = DateTime.Now;
                                myPhoneRelation.RoomID  = basic.RoomID;
                            }
                            myPhoneRelation.RelationType = "homefamily";
                            myPhoneRelation.RelationName = phoneName;
                            if (GetColumnValue("业主2联系方式", table, i, out Value))
                            {
                                myPhoneRelation.RelatePhoneNumber = Value.ToString().Trim();
                            }
                            myPhoneRelation.Save(helper);
                        }
                        phoneName = string.Empty;
                        if (GetColumnValue("住户1", table, i, out Value))
                        {
                            phoneName = Value.ToString().Trim();
                        }
                        if (!string.IsNullOrEmpty(phoneName))
                        {
                            var myPhoneRelation = phoneList.FirstOrDefault(p => p.RoomID == basic.RoomID && p.RelationName.Equals(phoneName));
                            if (myPhoneRelation == null)
                            {
                                myPhoneRelation         = new RoomPhoneRelation();
                                myPhoneRelation.AddTime = DateTime.Now;
                                myPhoneRelation.RoomID  = basic.RoomID;
                            }
                            myPhoneRelation.RelationType = "rentfamily";
                            myPhoneRelation.RelationName = phoneName;
                            if (GetColumnValue("住户1联系方式", table, i, out Value))
                            {
                                myPhoneRelation.RelatePhoneNumber = Value.ToString().Trim();
                            }
                            myPhoneRelation.Save(helper);
                        }
                        basic.Save(helper);
                    }
                    #endregion
                    if (!ImportFailed)
                    {
                        helper.Commit();
                        msg += "<p>导入完成</p>";
                    }
                    else
                    {
                        helper.Rollback();
                        msg += "<p>导入失败</p>";
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError("ImportSourceHandler", "visit: importroomsource", ex);
                    msg = "第" + (count + 2) + "行数据有问题,导入取消";
                    helper.Rollback();
                }
                context.Response.Write(msg);
            }
        }