/// <summary> /// Save changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { bool bEnabled = cbxEnabled.Checked; string sDesc = tbxDescription.Text; string sDivisionMemberIDs = hdnDivisionMemberIDs.Value; string sExectives = hdnExecutivesMembers.Value; int groupId = int.Parse(ddlGroupAccess.SelectedValue); StringBuilder sbOldGroupMemberIDs = new StringBuilder(); try { _bllRegions.SaveRegionAndMembersBase(CurrentRegion.RegionId, bEnabled, sDesc, groupId, sDivisionMemberIDs, sExectives); //Save group folder info if (groupId != 0) { GroupFolder groupFolder = new GroupFolder(); groupFolder.DoSaveGroupFolder(groupId, CurrentRegion.RegionId, "region", Convert.ToInt32(CurrentRegion.GroupID)); } } catch (Exception ex) { PageCommon.AlertMsg(this, "Failed to save region info, please try it again."); LPLog.LogMessage(LogType.Logerror, "Failed to save region info, reason: " + ex.Message); return; } PageCommon.WriteJsEnd(this, "Region saved successfully.", "window.location.href='" + sReturnPage + "?RegionID=" + CurrentRegion.RegionId + "'"); }
protected void btnSave_Click(object sender, EventArgs e) { bool bEnabled = this.ckbEnabled.Checked; string sDesc = this.txbDescription.Text.Trim(); string sBranchMemberIDs = this.hdnBranchMemberIDs.Value; string sExectives = this.hdnExecutiveIDs.Value; StringBuilder sbOldGroupMemberIDs = new StringBuilder(); int iGroupID = 0; if (this.ddlGroupAccess.SelectedIndex >= 0) { iGroupID = Convert.ToInt32(this.ddlGroupAccess.SelectedValue); } LPWeb.Model.Divisions model = this.divManager.GetModel(this.iDivisionID); int iOldGroupID = Convert.ToInt32(model.GroupID); try { this.divManager.SaveDivisionAndMembersBase(this.iDivisionID, bEnabled, sDesc, iGroupID, sBranchMemberIDs, sExectives); //Save group folder info GroupFolder groupFolder = new GroupFolder(); if (iGroupID != 0) { groupFolder.DoSaveGroupFolder(Convert.ToInt32(iGroupID), this.iDivisionID, "division", iOldGroupID); } model = this.divManager.GetModel(this.iDivisionID); 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)); } } PageCommon.WriteJsEnd(this, "Division saved successfully.", PageCommon.Js_RefreshSelf); } catch (Exception ex) { LPLog.LogMessage(ex.Message); PageCommon.WriteJsEnd(this, "Failed to save the record.", PageCommon.Js_RefreshSelf); } }
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); } }