protected void btnSetDeault_Click(object sender, EventArgs e) { //Response.Write(hifId.Value); if (string.IsNullOrEmpty(hifId.Value)) { return; } bool IsCancel = false; var val = hifId.Value.Split(':'); if (val.Count() != 2) { return; } IsCancel = Convert.ToBoolean(val[1]); PointFolders folder = new PointFolders(); folder.SetDefaultPoint(val[0], this.iBranchID, IsCancel); BindPointFolders(); }
protected void btnSave_Click(object sender, EventArgs e) { #region set Default if (!string.IsNullOrEmpty(hifId.Value)) { bool IsCancel = false; var val = hifId.Value.Split(':'); if (val.Count() != 2) { return; } IsCancel = Convert.ToBoolean(val[1]); PointFolders folder = new PointFolders(); folder.SetDefaultPoint(val[0], this.iBranchID, IsCancel); } #endregion bool bEnabled = this.ckbEnabled.Checked; string sDesc = this.txbDescription.Text.Trim(); string sFolderIDs = this.hdnFolderIDs.Value; string sManagers = this.hdnManagers.Value; LPWeb.Model.Branches model = new LPWeb.Model.Branches(); model = branchManager.GetModel(iBranchID); int iOldGroupID = Convert.ToInt32(model.GroupID); model.BranchId = iBranchID; model.Enabled = ckbEnabled.Checked; model.Desc = txbDescription.Text.Trim(); model.Name = ddlBranchName.SelectedItem.Text; if (ddlGroupAccess.Items.Count > 0) { model.GroupID = int.Parse(ddlGroupAccess.SelectedValue); } else { model.GroupID = 0; } model.BranchAddress = txbAddress.Text.Trim(); model.City = txbCity.Text.Trim(); model.Zip = txbZip.Text.Trim(); model.BranchState = ddlState.SelectedValue.Trim(); if (this.fuldWebLogo.HasFile && this.fuldWebLogo.FileName.ToUpper().IndexOf(".TIF") < 0) { model.WebsiteLogo = fuldWebLogo.FileBytes; } else { model.WebsiteLogo = null; } model.License1 = txbLicense1.Text.Trim(); model.License2 = txbLicense2.Text.Trim(); model.License3 = txbLicense3.Text.Trim(); model.License4 = txbLicense4.Text.Trim(); model.License5 = txbLicense5.Text.Trim(); model.Disclaimer = txbDisclaimer.Text.Trim(); model.Phone = txbPhone.Text.Trim(); model.Fax = txbFax.Text.Trim(); model.Email = txbEmail.Text.Trim(); model.WebURL = txbWebURL.Text.Trim(); var oldHomeBranch = model.HomeBranch; model.HomeBranch = chkHomeBranch.Checked; try { if (oldHomeBranch != model.HomeBranch) { branchManager.SetOtherHomeBranchFalse(model.BranchId); } branchManager.SaveBranchAndMembersBase(model, sFolderIDs, sManagers); //Save point folder enable status PointFolders pointFolderMgr = new PointFolders(); if (this.hdnDisableFolderIDs.Value.Trim() != "") { pointFolderMgr.UpdatePointFolderEnabled(this.hdnDisableFolderIDs.Value, false); } if (this.hdnEnableFolderIDs.Value.Trim() != "") { pointFolderMgr.UpdatePointFolderEnabled(this.hdnEnableFolderIDs.Value, true); } //this.divManager.SaveDivisionAndMembersBase(this.iDivisionID, bEnabled, sDesc, sBranchMemberIDs, sExectives); //Save group folder info model = branchManager.GetModel(model.BranchId); GroupFolder groupFolder = new GroupFolder(); if (model.GroupID != 0) { groupFolder.DoSaveGroupFolder(Convert.ToInt32(model.GroupID), model.BranchId, "branch", iOldGroupID); } if (model.RegionID != 0 && model.RegionID != null) { Regions regMgr = new Regions(); LPWeb.Model.Regions regionModel = regMgr.GetModel(Convert.ToInt32(model.RegionID)); if (regionModel.GroupID != null && regionModel.GroupID != 0) { groupFolder.DoSaveGroupFolder(Convert.ToInt32(regionModel.GroupID), Convert.ToInt32(model.RegionID), "region", Convert.ToInt32(regionModel.GroupID)); } } if (model.DivisionID != 0 && model.DivisionID != null) { Divisions divMgr = new Divisions(); LPWeb.Model.Divisions divModel = divMgr.GetModel(Convert.ToInt32(model.DivisionID)); if (divModel.GroupID != null && divModel.GroupID != 0) { groupFolder.DoSaveGroupFolder(Convert.ToInt32(divModel.GroupID), Convert.ToInt32(model.DivisionID), "division", Convert.ToInt32(divModel.GroupID)); } } PageCommon.WriteJsEnd(this, "Branch saved successfully.", PageCommon.Js_RefreshSelf); } catch { PageCommon.WriteJsEnd(this, "Failed to save the record.", PageCommon.Js_RefreshSelf); } }