コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Request.QueryString["RoomID"]))
     {
         int.TryParse(Request.QueryString["RoomID"], out RoomID);
     }
     if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
     {
         if (int.TryParse(Request.QueryString["ID"], out ID))
         {
             relation = RoomPhoneRelation.GetRoomPhoneRelation(ID);
         }
     }
     if (relation != null)
     {
         this.tdRelationProperty.Value = relation.RelationProperty;
         this.tdRelationType.Value     = relation.RelationType;
         this.tdCompanyName.Value      = relation.CompanyName;
         this.tdRelateName.Value       = relation.RelationName;
         this.tdRelatePhone.Value      = relation.RelatePhoneNumber;
         this.tdIsDefault.Value        = relation.IsDefault ? "1" : "0";
         this.tdIDCardType.Value       = relation.IDCardType == int.MinValue ? "1" : relation.IDCardType.ToString();
         this.tdRelateIDCard.Value     = relation.RelationIDCard;
         this.tdRemark.Value           = relation.Remark;
         RoomID = relation.RoomID;
     }
 }
コード例 #2
0
        private void savefamilyphoto(HttpContext context)
        {
            int ID       = WebUtil.GetIntValue(context, "ID");
            var relation = RoomPhoneRelation.GetRoomPhoneRelation(ID);
            HttpFileCollection uploadFiles = context.Request.Files;

            for (int i = 0; i < uploadFiles.Count; i++)
            {
                HttpPostedFile postedFile  = uploadFiles[i];
                string         fileOriName = postedFile.FileName;
                if (fileOriName != "" && fileOriName != null)
                {
                    string extension = System.IO.Path.GetExtension(fileOriName).ToLower();
                    string fileName  = DateTime.Now.ToFileTime().ToString() + extension;
                    string filepath  = "/upload/Family/";
                    string rootPath  = HttpContext.Current.Server.MapPath("~" + filepath);
                    if (!System.IO.Directory.Exists(rootPath))
                    {
                        System.IO.Directory.CreateDirectory(rootPath);
                    }
                    string Path = rootPath + fileName;
                    postedFile.SaveAs(Path);
                    relation.HeadImg = filepath + fileName;
                    relation.Save();
                }
            }
            WebUtil.WriteJson(context, new { status = true });
        }
コード例 #3
0
        private void saveroomphonefamily(HttpContext context)
        {
            int ID     = GetIntValue(context, "ID");
            int RoomID = GetIntValue(context, "RoomID");
            RoomPhoneRelation relation = null;

            if (ID > 0)
            {
                relation = RoomPhoneRelation.GetRoomPhoneRelation(ID);
            }
            if (relation == null)
            {
                relation         = new RoomPhoneRelation();
                relation.AddTime = DateTime.Now;
                relation.RoomID  = RoomID;
            }
            relation.RelationProperty  = WebUtil.getServerValue(context, "tdRelationProperty");
            relation.RelationType      = WebUtil.getServerValue(context, "tdRelationType");
            relation.CompanyName       = WebUtil.getServerValue(context, "tdCompanyName");
            relation.RelationName      = WebUtil.getServerValue(context, "tdRelateName");
            relation.RelatePhoneNumber = WebUtil.getServerValue(context, "tdRelatePhone");
            relation.IsDefault         = WebUtil.getServerIntValue(context, "tdIsDefault") == 1;
            relation.IDCardType        = WebUtil.getServerIntValue(context, "tdIDCardType");
            relation.RelationIDCard    = WebUtil.getServerValue(context, "tdRelateIDCard");
            relation.Remark            = WebUtil.getServerValue(context, "tdRemark");
            string cmdtext = string.Empty;

            if (relation.IsDefault)
            {
                cmdtext += "update [RoomPhoneRelation] set [IsDefault]=0 where RoomID=@RoomID and ID!=@RelationID;";
            }
            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    relation.Save(helper);
                    if (!string.IsNullOrEmpty(cmdtext))
                    {
                        List <SqlParameter> parameters = new List <SqlParameter>();
                        parameters.Add(new SqlParameter("@RoomID", relation.RoomID));
                        parameters.Add(new SqlParameter("@RoomOwner", relation.RelationName));
                        parameters.Add(new SqlParameter("@OwnerPhone", relation.RelatePhoneNumber));
                        parameters.Add(new SqlParameter("@OwnerIDCard", relation.RelationIDCard));
                        parameters.Add(new SqlParameter("@RelationID", relation.ID > 0 ? relation.ID : 0));
                        helper.Execute(cmdtext, CommandType.Text, parameters);
                    }
                    helper.Commit();
                    WebUtil.WriteJson(context, new { status = true, ID = relation.ID });
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    Utility.LogHelper.WriteError("RoomResourceHandler", "命令:saveroomphonefamily", ex);
                    context.Response.Write("{\"status\":false}");
                    WebUtil.WriteJson(context, new { status = false });
                }
            }
        }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
     {
         int ID = 0;
         if (int.TryParse(Request.QueryString["ID"], out ID))
         {
             relation = RoomPhoneRelation.GetRoomPhoneRelation(ID);
         }
     }
     if (relation != null)
     {
         this.tdRelationProperty.Value  = relation.RelationProperty;
         this.tdRelateName.Value        = relation.RelationName;
         this.tdRelatePhone.Value       = relation.RelatePhoneNumber;
         this.tdRelateIDCard.Value      = relation.RelationIDCard;
         this.tdIsDefault.Checked       = relation.IsDefault;
         this.tdIsChargeMan.Checked     = relation.IsChargeMan;
         this.tdIsChargeFee.Checked     = relation.IsChargeFee;
         this.tdIDCardType.Value        = relation.IDCardType == int.MinValue ? "1" : relation.IDCardType.ToString();
         this.tdBirthday.Value          = relation.Birthday == DateTime.MinValue ? "" : relation.Birthday.ToString("yyyy-MM-dd");
         this.tdEmailAddress.Value      = relation.EmailAddress;
         this.tdHomeAddress.Value       = relation.HomeAddress;
         this.tdOfficeAddress.Value     = relation.OfficeAddress;
         this.tdBankName.Value          = relation.BankName;
         this.tdBankAccountName.Value   = relation.BankAccountName;
         this.tdBankNo.Value            = relation.BankAccountNo;
         this.tdCustomOne.Value         = relation.CustomOne;
         this.tdCustomTwo.Value         = relation.CustomTwo;
         this.tdCustomThree.Value       = relation.CustomThree;
         this.tdCustomFour.Value        = relation.CustomFour;
         this.tdRemark.Value            = relation.Remark;
         this.tdContractStartTime.Value = relation.ContractStartTime == DateTime.MinValue ? "" : relation.ContractStartTime.ToString("yyyy-MM-dd");
         this.tdContractEndTime.Value   = relation.ContractEndTime == DateTime.MinValue ? "" : relation.ContractEndTime.ToString("yyyy-MM-dd");
         this.tdBrandNote.Value         = relation.BrandInfo;
         this.tdContractNote.Value      = relation.ContractNote;
         this.tdInteresting.Value       = relation.Interesting;
         this.tdConsumeMore.Value       = relation.ConsumeMore;
         this.tdBelongTeam.Value        = relation.BelongTeam;
         this.tdOneCardNumber.Value     = relation.OneCardNumber;
         this.tdChargeForMan.Value      = relation.ChargeForMan;
         this.tdCompanyName.Value       = relation.CompanyName;
         this.canEditName = true;
         if (relation.ContractID > 0)
         {
             var contract_room = Foresight.DataAccess.Contract_Room.GetContract_RoomListByContractID(relation.ContractID).FirstOrDefault(p => p.RoomID == relation.RoomID);
             this.canEditName = contract_room == null;
         }
         this.tdRelationType.Value = relation.RelationType;
     }
 }
コード例 #5
0
 private void LoadlRelateFamily(HttpContext context)
 {
     try
     {
         int      RoomID        = int.Parse(context.Request.Params["RoomID"]);
         string   page          = context.Request.Form["page"];
         string   rows          = context.Request.Form["rows"];
         string   RelationType  = context.Request.Params["RelationType"];
         long     startRowIndex = (long.Parse(page) - 1) * long.Parse(rows);
         int      pageSize      = int.Parse(rows);
         DataGrid dg            = RoomPhoneRelation.GetRoomPhoneRelationGridByRoomID(RoomID, RelationType, "order by ID asc", startRowIndex, pageSize);
         string   result        = JsonConvert.SerializeObject(dg);
         context.Response.Write(result);
     }
     catch (Exception ex)
     {
         Utility.LogHelper.WriteError("RoomResourceHandler", "命令:LoadlRelateFamily", ex);
         context.Response.Write("{\"rows\":[],\"total\":0,\"page\":0}");
     }
 }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RoomPhoneRelation relationPhone = null;

            if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
            {
                var op = Request.QueryString["op"];
                if (!string.IsNullOrEmpty(op) && op.Equals("view"))
                {
                    this.canEdit = false;
                }
                ID = 0;
                if (int.TryParse(Request.QueryString["ID"], out ID))
                {
                    relationPhone = RoomPhoneRelation.GetRoomPhoneRelation(ID);
                }
            }
            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;
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.tdWidth.Value  = "210";
            this.tdHeight.Value = "99";
            string     IDs    = Request.QueryString["IDs"];
            List <int> IDList = new List <int>();

            if (string.IsNullOrEmpty(IDs))
            {
                Response.End();
                return;
            }
            if (!string.IsNullOrEmpty(IDs))
            {
                IDList = JsonConvert.DeserializeObject <List <int> >(IDs);
            }
            if (!IsPostBack)
            {
                int RoomID             = 0;
                int ContractID         = 0;
                int DefaultChargeManID = 0;
                var list = ViewRoomFee.GetViewRoomFeeListByIDs(IDList, UserID: WebUtil.GetUser(this.Context).UserID);
                if (list.Length > 0)
                {
                    RoomID             = list[0].RoomID;
                    ContractID         = list[0].ContractID;
                    DefaultChargeManID = list[0].DefaultChargeManID;
                }
                foreach (var item in list)
                {
                    money += item.TotalCost;
                }
                this.rptProject.DataSource = list;
                this.rptProject.DataBind();
                var project = Foresight.DataAccess.Project.GetProjectByID(ID: RoomID, ContractID: ContractID);
                if (project != null)
                {
                    this.tdRemark.Value         = project.CuiFeiNote;
                    this.tdFirstTitle.InnerHtml = project.PrintTitle;
                    if (project.IsDefinePrintSize)
                    {
                        this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                        this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
                    }
                    else
                    {
                        this.tdWidth.Value  = "210";
                        this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
                    }
                    this.IsPrintUnitPrice = project.IsPrintUnitPrice;
                    if (this.IsPrintUnitPrice)
                    {
                        this.ColumnCount++;
                    }
                    this.FullName = project.FullName + "-" + project.Name;
                }
                RoomPhoneRelation relation = null;
                if (DefaultChargeManID > 0)
                {
                    relation = RoomPhoneRelation.GetRoomPhoneRelation(DefaultChargeManID);
                }
                if (relation == null)
                {
                    relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID);
                }
                if (relation != null)
                {
                    this.OwnerName = relation.RelationName;
                }
                SetInfo(RoomID);
            }
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.tdWidth.Value  = "210";
            this.tdHeight.Value = "99";
            int PrintID = 0;

            int.TryParse(Request.QueryString["PrintID"], out PrintID);
            string     IDs        = Request.QueryString["IDs"];
            List <int> IDList     = new List <int>();
            List <int> RoomIDList = new List <int>();

            if (PrintID == 0)
            {
                if (string.IsNullOrEmpty(IDs))
                {
                    Response.End();
                    return;
                }
            }
            if (!string.IsNullOrEmpty(IDs))
            {
                IDList = JsonConvert.DeserializeObject <List <int> >(IDs);
            }
            if (!IsPostBack)
            {
                int RoomID             = 0;
                int ContractID         = 0;
                int DefaultChargeManID = 0;
                if (PrintID > 0)
                {
                    var list = ViewRoomFeeHistory.GetViewRoomFeeHistoryListByIDs(0, IDList, PrintID);
                    if (list.Length > 0)
                    {
                        RoomID             = list[0].RoomID;
                        ContractID         = list[0].ContractID;
                        DefaultChargeManID = list[0].DefaultChargeManID;
                    }
                    this.rptProject.DataSource = list;
                    this.rptProject.DataBind();
                    printRoomFeeHistory = PrintRoomFeeHistory.GetPrintRoomFeeHistory(PrintID);
                }
                else
                {
                    var list = ViewTempRoomFeeHistory.GetViewTempRoomFeeHistoryListByIDs(IDList);
                    if (list.Length > 0)
                    {
                        RoomID = list[0].RoomID;
                    }
                    foreach (var item in list)
                    {
                        money     += item.ChargeFee;
                        TotalCost += item.Cost;
                    }
                    var historyfees = list;
                    this.rptProject.DataSource = historyfees;
                    this.rptProject.DataBind();
                }
                var project = Foresight.DataAccess.Project.GetProjectByID(ID: RoomID, ContractID: ContractID);
                if (project != null)
                {
                    this.tdRemark.Value     = project.PrintNote;
                    this.tdFirstTitle.Value = project.PrintTitle;
                    if (project.IsDefinePrintSize)
                    {
                        this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                        this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
                    }
                    else
                    {
                        this.tdWidth.Value  = "210";
                        this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
                    }
                    this.FullName = project.FullName + "-" + project.Name;
                }
                RoomPhoneRelation relation = null;
                if (DefaultChargeManID > 0)
                {
                    relation = RoomPhoneRelation.GetRoomPhoneRelation(DefaultChargeManID);
                }
                if (relation == null)
                {
                    relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID);
                }
                if (relation != null)
                {
                    this.OwnerName = relation.RelationName;
                }
                if (PrintID <= 0)
                {
                    GetInfo(RoomID);
                }
                SetInfo();
            }
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string         GUID        = Request.QueryString["guid"];
            var            temp        = ChargeBackGuaranteeTemp.GetChargeBackGuaranteeTempListByGUID(GUID);
            List <decimal> RealPayList = new List <decimal>();
            List <string>  RemarkList  = new List <string>();

            this.tdWidth.Value  = "210";
            this.tdHeight.Value = "99";
            List <int> IDList = temp.Select(p => p.HistoryID).ToList();

            if (IDList.Count == 0)
            {
                Response.End();
                return;
            }
            if (!IsPostBack)
            {
                int RoomID             = 0;
                int DefaultChargeManID = 0;
                var list = ViewRoomFeeHistory.GetViewRoomFeeHistoryListByIDs(IDList);
                if (list.Length == 0)
                {
                    Response.End();
                    return;
                }
                RoomID             = list[0].RoomID;
                DefaultChargeManID = list[0].DefaultChargeManID;
                var historyfees = list;
                var newlist     = new List <RoomFeeModule>();
                foreach (var item in temp)
                {
                    var roomFeeModule      = new RoomFeeModule();
                    var viewRoomFeeHistory = list.FirstOrDefault(p => p.HistoryID == item.HistoryID);
                    if (viewRoomFeeHistory != null)
                    {
                        roomFeeModule.HistoryID   = viewRoomFeeHistory.HistoryID;
                        roomFeeModule.ChargeTime  = viewRoomFeeHistory.ChargeTime;
                        roomFeeModule.RealCost    = item.RealPay;
                        roomFeeModule.ChargeName  = viewRoomFeeHistory.ChargeName;
                        roomFeeModule.PrintNumber = viewRoomFeeHistory.PrintNumber;
                        roomFeeModule.Remark      = item.Remark;
                        roomFeeModule.ChargeMan   = viewRoomFeeHistory.ChargeMan;
                        this.money += roomFeeModule.RealCost;
                        newlist.Add(roomFeeModule);
                    }
                }
                this.rptProject.DataSource = newlist;
                this.rptProject.DataBind();
                var project = Foresight.DataAccess.Project.GetProjectByID(ID: RoomID, ContractID: 0);
                if (project != null)
                {
                    this.tdRemark.Value = project.PrintCancelNote;
                    if (project.IsDefinePrintSize)
                    {
                        this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                        this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
                    }
                    else
                    {
                        this.tdWidth.Value  = "210";
                        this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
                    }
                    this.FirstTitle = project.PayPrintTitle;
                    this.SubTitle   = project.PayPrintSubTitle;
                    if (string.IsNullOrEmpty(this.FirstTitle))
                    {
                        this.FirstTitle = WebUtil.GetCompany(this.Context).CompanyName;
                    }
                    this.tdFirstTitle.InnerHtml = this.FirstTitle;
                    if (string.IsNullOrEmpty(this.SubTitle))
                    {
                        this.SubTitle = "付款单据";
                    }
                    this.tdSubTitle.InnerText = this.SubTitle;
                    this.FullName             = project.FullName + "-" + project.Name;
                }
                RoomPhoneRelation relation = null;
                if (DefaultChargeManID > 0)
                {
                    relation = RoomPhoneRelation.GetRoomPhoneRelation(DefaultChargeManID);
                }
                if (relation == null)
                {
                    relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID: 0);
                }
                if (relation != null)
                {
                    this.OwnerName = relation.RelationName;
                }
                GetInfo(RoomID);
                SetInfo();
            }
        }
コード例 #10
0
        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;
                }
            }
        }
コード例 #11
0
 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;
         }
     }
 }
コード例 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.tdWidth.Value  = "210";
         this.tdHeight.Value = "99";
         int.TryParse(Request.QueryString["PrintID"], out PrintID);
         int.TryParse(Request.QueryString["ChargeID"], out ChargeID);
         this.RoomIDs = Request.QueryString["RoomIDs"];
         List <int> RoomIDList = new List <int>();
         var        newlist    = new List <Utility.RoomFeeModule>();
         if (!string.IsNullOrEmpty(RoomIDs))
         {
             RoomIDList = JsonConvert.DeserializeObject <List <int> >(RoomIDs);
         }
         if (PrintID > 0)
         {
             printRoomFeeHistory = PrintRoomFeeHistory.GetPrintRoomFeeHistory(PrintID);
             var list = ViewRoomFeeHistory.GetPreChargeViewRoomFeeHistoryList(PrintID);
             for (int i = 0; i < list.Length; i++)
             {
                 var roomFeeModule = new Utility.RoomFeeModule();
                 roomFeeModule.ChargeFeeSummaryName    = list[i].ChargeFeeSummaryName;
                 roomFeeModule.RealCost                = list[i].RealCost;
                 roomFeeModule.ChargeFeeCurrentBalance = list[i].ChargeFeeCurrentBalance;
                 roomFeeModule.TotalRestBalance        = list[i].ChargeFeeCurrentBalance - list[i].RealCost;
                 newlist.Add(roomFeeModule);
             }
             this.money = printRoomFeeHistory.RealCost;
         }
         else
         {
             string ChargeFeeSummaryName = "退预收款";
             if (ChargeID > 0)
             {
                 var chargesummary = Foresight.DataAccess.ChargeSummary.GetChargeSummary(ChargeID);
                 ChargeFeeSummaryName = chargesummary != null ? "退" + chargesummary.Name : "退预收款";
             }
             decimal ChargeFeeCurrentBalance = Foresight.DataAccess.ViewRoomBalance.GetPreChargeBalance(RoomIDList, ChargeID);
             var     roomFeeModule           = new Utility.RoomFeeModule();
             roomFeeModule.ChargeFeeSummaryName    = ChargeFeeSummaryName;
             roomFeeModule.RealCost                = ChargeFeeCurrentBalance;
             roomFeeModule.ChargeFeeCurrentBalance = ChargeFeeCurrentBalance;
             roomFeeModule.TotalRestBalance        = 0;
             newlist.Add(roomFeeModule);
             this.money = ChargeFeeCurrentBalance;
         }
         this.rptProject.DataSource = newlist;
         this.rptProject.DataBind();
         var project = Foresight.DataAccess.Project.GetProject(RoomIDList[0]);
         if (project != null)
         {
             this.tdRemark.Value = project.PrintNote;
             if (project.IsDefinePrintSize)
             {
                 this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                 this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
             }
             else
             {
                 this.tdWidth.Value  = "210";
                 this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
             }
             this.FirstTitle = project.PayPrintTitle;
             this.SubTitle   = project.PayPrintSubTitle;
             if (string.IsNullOrEmpty(this.FirstTitle))
             {
                 this.FirstTitle = WebUtil.GetCompany(this.Context).CompanyName;
             }
             this.tdFirstTitle.InnerHtml = this.FirstTitle;
             if (string.IsNullOrEmpty(this.SubTitle))
             {
                 this.SubTitle = "付款单据";
             }
             this.tdSubTitle.InnerText = this.SubTitle;
             this.FullName             = project.FullName + "-" + project.Name;
         }
         RoomPhoneRelation relation = null;
         if (relation == null)
         {
             relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomIDList[0], 0);
         }
         if (relation != null)
         {
             this.OwnerName = relation.RelationName;
         }
         if (printRoomFeeHistory == null)
         {
             GetInfo(RoomIDList[0]);
         }
         SetInfo();
     }
 }
コード例 #13
0
        private void saveapppwd(HttpContext context)
        {
            int RelationID = GetIntValue(context, "RelationID");
            var relation   = RoomPhoneRelation.GetRoomPhoneRelation(RelationID);

            if (relation == null)
            {
                WebUtil.WriteJson(context, new { status = false, errormsg = "房间用户不存在" });
                return;
            }
            string LoginName = context.Request.Params["LoginName"];
            string Pwd       = context.Request.Params["Password"];
            int    IsLocked  = WebUtil.GetIntValue(context, "IsLocked");
            User   user      = null;

            if (relation.UserID > 0)
            {
                user = User.GetUser(relation.UserID);
            }
            var exist_user = User.GetAPPUserByLoginName(LoginName);

            if (user == null && exist_user != null)
            {
                WebUtil.WriteJson(context, new { status = false, errormsg = "登录名已存在" });
                return;
            }
            if (user != null && exist_user != null && user.UserID != exist_user.UserID)
            {
                WebUtil.WriteJson(context, new { status = false, errormsg = "登录名已存在" });
                return;
            }
            if (user == null)
            {
                user            = new User();
                user.CreateTime = DateTime.Now;
                user.Type       = UserTypeDefine.APPCustomer.ToString();
                user.RealName   = relation.RelationName;
                user.RelationID = RelationID;
            }
            user.LoginName = LoginName;
            if (!string.IsNullOrEmpty(Pwd))
            {
                user.Password = User.EncryptPassword(Pwd);
            }
            user.IsLocked = IsLocked == 1 ? true : false;
            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    user.Save(helper);
                    relation.UserID = user.UserID;
                    relation.Save(helper);
                    helper.Commit();
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    LogHelper.WriteError("UserHandler", "saveapppwd", ex);
                    WebUtil.WriteJson(context, new { status = false });
                }
            }
            var    company  = Foresight.DataAccess.Company.GetCompany(WebUtil.GetCompanyID(context));
            string errormsg = string.Empty;

            if (!EncryptHelper.SaveAPPUser(company, user.LoginName, user.Password, user.UserID, user.Type, out errormsg))
            {
                user.Delete();
                relation.UserID = 0;
                relation.Save();
                var result = new { status = false, msg = errormsg };
                WebUtil.WriteJson(context, result);
                return;
            }
            var usercompany = Foresight.DataAccess.UserCompany.GetUserCompanyByUserID(user.UserID);

            if (usercompany != null)
            {
                usercompany.Delete();
            }
            usercompany           = new UserCompany();
            usercompany.CompanyID = company.CompanyID;
            usercompany.UserID    = user.UserID;
            usercompany.Save();
            context.Response.Write("{\"status\":true}");
        }
コード例 #14
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);
            }
        }