protected void gridViewList_RowCommand(object sender, GridViewCommandEventArgs e) { string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(';'); if (e.CommandName == "EditRow") { ViewState["ZoneId"] = Convert.ToString(arg[0]); long ZoneId = Utility.GetLong(ViewState["ZoneId"]); ViewState["Update"] = "Update"; LookupUtility.BindRegionLookup(ddlRegion, SessionContext); ZoneEntity entity = new ConfigrationRepository(SessionContext).GetZoneById(ZoneId).FirstOrDefault(); Utility.SetLookupSelectedValue(ddlRegion, Convert.ToString(entity.RegionId)); txtZoneName.Text = entity.ZoneName; DIVList.Visible = false; DIVDetail.Visible = true; } else if (e.CommandName == "DeleteRow") { ViewState["ZoneId"] = Convert.ToString(arg[0]); long ZoneId = Utility.GetLong(ViewState["ZoneId"]); ViewState["Delete"] = "Delete"; ShowYesNoPopup("Are you sure you want to delete this Zone?"); } }
protected void MasterPage_YesClickHandler(object sender, EventArgs e) { if (ViewState["Delete"] != null) { try { ClusterEntity entity = new ClusterEntity(); entity.OperationId = (int)OperationType.Delete; entity.ClusterId = Utility.GetLong(ViewState["ClusterId"]); OperationStatusEntity c = new ConfigrationRepository(SessionContext).UpdateCluster(entity); if (c.StatusResult == true) { ShowInfoMessage(c.InfoMessage); ClearPageControl(); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (BaseException bex) { ShowErrorMessage(bex.Message); } } }
protected void gridViewList_RowCommand(object sender, GridViewCommandEventArgs e) { string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(';'); if (e.CommandName == "EditRow") { ViewState["RegionId"] = Convert.ToString(arg[0]); long RegionId = Utility.GetLong(ViewState["RegionId"]); ViewState["Update"] = "Update"; RegionEntity entity = new ConfigrationRepository(SessionContext).GetRegionById(RegionId).FirstOrDefault(); txtRegionName.Text = entity.RegionName; DIVList.Visible = false; DIVDetail.Visible = true; } else if (e.CommandName == "DeleteRow") { ViewState["RegionId"] = Convert.ToString(arg[0]); long RegionId = Utility.GetLong(ViewState["RegionId"]); ViewState["Delete"] = "Delete"; ShowYesNoPopup("Are you sure you want to delete this Region?"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ValidateBusinessData("G1"); ValidateBusinessData("G2"); ValidateBusinessData("G3"); ValidateBusinessData("G4"); ValidateBusinessData("G5"); ValidateBusinessData("G6"); SiteEntity entity = new SiteEntity(); if (Convert.ToString(ViewState["Add"]) == "Add") { entity.OperationId = 1; } else if (Convert.ToString(ViewState["Update"]) == "Update") { entity.OperationId = 2; entity.SiteId = Utility.GetLong(ViewState["SiteId"]); } entity.SiteName = txtSiteName.Text.Trim(); entity.RegionId = Utility.GetLong(ddlRegion.SelectedValue); entity.ZoneId = Utility.GetLong(ddlZone.SelectedValue); entity.BranchId = Utility.GetLong(ddlBranch.SelectedValue); entity.HubId = Utility.GetLong(ddlHub.SelectedValue); entity.ClusterId = Utility.GetLong(ddlCluster.SelectedValue); OperationStatusEntity c = new ConfigrationRepository(SessionContext).UpdateSite(entity); if (c.StatusResult == true) { ShowInfoMessage(c.InfoMessage); ClearPageControl(); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (ValidationException ex) { ShowErrorMessage(ex.Message); } catch (BaseException be) { ShowErrorMessage(be.DisplayMessage); } }
private void FillGrid() { var list = new ConfigrationRepository(SessionContext).GetAllZoneQuery(txtZoneNameSearch.Text, Utility.GetLong(ddlRegionSearch.SelectedValue)); gridViewList.LoadData(list); DIVList.Visible = true; DIVDetail.Visible = false; ViewState["Add"] = null; ViewState["Update"] = null; ViewState["Delete"] = null; ViewState["ZoneId"] = null; }
private void FillGrid() { var list = new ConfigrationRepository(SessionContext).GetCompanyList(); gridViewList.LoadData(list); DIVList.Visible = true; DIVDetail.Visible = false; ViewState["Add"] = null; ViewState["Update"] = null; ViewState["CompanyId"] = null; }
private void FillGrid() { var list = new ConfigrationRepository(SessionContext).GetAllRegionQuery(txtRegionNameSearch.Text); gridViewList.LoadData(list); DIVList.Visible = true; DIVDetail.Visible = false; ViewState["Add"] = null; ViewState["Update"] = null; ViewState["Delete"] = null; ViewState["RegionId"] = null; }
protected void gridViewList_RowCommand(object sender, GridViewCommandEventArgs e) { string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(';'); if (e.CommandName == "EditRow") { ViewState["SiteId"] = Convert.ToString(arg[0]); long SiteId = Utility.GetLong(ViewState["SiteId"]); ViewState["Update"] = "Update"; LookupUtility.BindRegionLookup(ddlRegion, SessionContext); SiteEntity entity = new ConfigrationRepository(SessionContext).GetSiteById(SiteId).FirstOrDefault(); txtSiteName.Text = entity.SiteName; Utility.SetLookupSelectedValue(ddlRegion, Convert.ToString(entity.RegionId)); ddlRegion_SelectedIndexChanged(null, null); Utility.SetLookupSelectedValue(ddlZone, Convert.ToString(entity.ZoneId)); ddlZone_SelectedIndexChanged(null, null); Utility.SetLookupSelectedValue(ddlBranch, Convert.ToString(entity.BranchId)); ddlBranch_SelectedIndexChanged(null, null); Utility.SetLookupSelectedValue(ddlHub, Convert.ToString(entity.HubId)); ddlHub_SelectedIndexChanged(null, null); Utility.SetLookupSelectedValue(ddlCluster, Convert.ToString(entity.ClusterId)); DIVList.Visible = false; DIVDetail.Visible = true; } else if (e.CommandName == "DeleteRow") { ViewState["SiteId"] = Convert.ToString(arg[0]); long SiteId = Utility.GetLong(ViewState["SiteId"]); ViewState["Delete"] = "Delete"; ShowYesNoPopup("Are you sure you want to delete this Site?"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ValidateBusinessData("G1"); RegionEntity entity = new RegionEntity(); if (Convert.ToString(ViewState["Add"]) == "Add") { entity.OperationId = 1; } else if (Convert.ToString(ViewState["Update"]) == "Update") { entity.OperationId = 2; entity.RegionId = Utility.GetLong(ViewState["RegionId"]); } entity.RegionName = txtRegionName.Text.Trim(); OperationStatusEntity c = new ConfigrationRepository(SessionContext).UpdateRegion(entity); if (c.StatusResult == true) { ShowInfoMessage(c.InfoMessage); ClearPageControl(); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (ValidationException ex) { ShowErrorMessage(ex.Message); } catch (BaseException be) { ShowErrorMessage(be.DisplayMessage); } }
protected void gridViewList_RowCommand(object sender, GridViewCommandEventArgs e) { string[] arg = new string[2]; arg = e.CommandArgument.ToString().Split(';'); if (e.CommandName == "EditRow") { ViewState["CompanyId"] = Convert.ToString(arg[0]); int CompanyId = Utility.GetInt(ViewState["CompanyId"]); ViewState["Update"] = "Update"; //LookupUtility.BindTownLookup(ddlTown, SessionContext); CompanyEntity entity = new ConfigrationRepository(SessionContext).GetCompanyById(CompanyId); Utility.SetLookupSelectedValue(ddlTown, Convert.ToString(entity.TownId)); txtCompanyName.Text = entity.CompanyName; txtCompanyPrefix.Text = entity.CompanyPrefix; txtCINNumber.Text = entity.CIN; txtGSTNumber.Text = entity.GSTNumber; txtCompanyAddress1.Text = entity.CompanyAddress1; txtCompanyAddress2.Text = entity.CompanyAddress2; txtCompanyContactPerson.Text = entity.CompanyContactPerson; txtCompanyContactMobile.Text = entity.CompanyMobile; txtCompanyPhone.Text = entity.CompanyPhone; txtCompanyZipcode.Text = entity.CompanyZipcode; txtEmailId.Text = entity.EmailId; txtWebsite.Text = entity.Website; ImageUserImage.ImageUrl = entity.CompanyLogo; chkIsActive.Checked = entity.IsActive; DIVList.Visible = false; DIVDetail.Visible = true; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ValidateBusinessData("G1"); ValidateBusinessData("G2"); ValidateBusinessData("G3"); ValidateBusinessData("G4"); ValidateBusinessData("G5"); ValidateBusinessData("G6"); ValidateBusinessData("G7"); byte[] imgbyte = null; string getFileName = string.Empty; string uploadedFileName = string.Empty; if (txtCompanyLogo.HasFile) { string completePath = string.Empty; string imgType = string.Empty; string[] stringListArr = System.IO.Path.GetFileName(txtCompanyLogo.PostedFile.FileName).Split('.'); imgType = txtCompanyLogo.PostedFile.ContentType; if ((imgType == "image/gif" || imgType == "image/pjpeg" || imgType == "image/jpeg" || imgType == "image/x-png" || stringListArr[1].ToString().Trim().ToLower() == "png")) { int length = txtCompanyLogo.PostedFile.ContentLength; imgbyte = new byte[length]; HttpPostedFile imageFile = txtCompanyLogo.PostedFile; imageFile.InputStream.Read(imgbyte, 0, length); MemoryStream stream = new MemoryStream(imgbyte); int kilobytes = Int32.Parse(Convert.ToString(stream.Length)) / 1024; // Get Size In KB if (kilobytes > 200) { ShowPopup("Please Select a image file less than 200 KB in Size."); return; } else { getFileName = txtCompanyLogo.PostedFile.FileName; if (txtCompanyLogo.PostedFile.ContentLength > 0) { var container = Utility.GetStorageContainer(); string blobFileName = Guid.NewGuid().ToString("N"); string fileExtension = Path.GetExtension(imageFile.FileName); CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobFileName + fileExtension); blockBlob.Properties.ContentType = "image/png"; stream.Seek(0, SeekOrigin.Begin); //input.Position = 0; blockBlob.UploadFromStream(stream); uploadedFileName = blockBlob.StorageUri.PrimaryUri.OriginalString; } } } else { ShowPopup("Please Select a valid logo file."); return; } } CompanyEntity entity = new CompanyEntity(); entity.CompanyId = Utility.GetInt(ViewState["CompanyId"]); entity.CompanyName = txtCompanyName.Text.Trim(); entity.CompanyPrefix = txtCompanyPrefix.Text.Trim(); entity.CIN = txtCINNumber.Text; entity.GSTNumber = txtGSTNumber.Text; entity.CompanyAddress1 = txtCompanyAddress1.Text.Trim(); entity.CompanyAddress2 = txtCompanyAddress2.Text; entity.TownId = Utility.GetLong(ddlTown.SelectedValue); entity.CompanyContactPerson = txtCompanyContactPerson.Text.Trim(); entity.CompanyMobile = txtCompanyContactMobile.Text.Trim(); entity.CompanyPhone = txtCompanyPhone.Text; entity.CompanyZipcode = txtCompanyZipcode.Text.Trim(); entity.EmailId = txtEmailId.Text; entity.Website = txtWebsite.Text; entity.FinancialYearId = SessionClass.FinancialYearId; entity.CompanyLogo = uploadedFileName; entity.IsActive = chkIsActive.Checked; entity.CreatedBy = SessionClass.LoginUserEntity.UserId; OperationStatusEntity c = new ConfigrationRepository(SessionContext).UpdateCompany(entity); if (c.StatusResult == true) { ShowInfoMessage(c.InfoMessage); FillGrid(); } else { ShowErrorMessage(c.InfoMessage); } } catch (ValidationException ex) { ShowErrorMessage(ex.Message); } catch (BaseException be) { ShowErrorMessage(be.DisplayMessage); } }