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; } }
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 }); }
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 }); } } }
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; } }
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; } }
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); } }
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(); } }
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(); } }
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; } } }
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; } } }
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}"); }