private void LoadUserGrid(ePageIndex ePageIndex) { eDesignation Designation = CU.GeteDesignationId(CU.GetUsersId()); int? Status = null; if (chkActive.Checked && !chkDeactive.Checked) { Status = (int)eStatus.Active; } else if (!chkActive.Checked && chkDeactive.Checked) { Status = (int)eStatus.Deactive; } var objQuery = new Query() { OrganizationId = ddlOrganization.zIsSelect() ? ddlOrganization.zToInt() : null, FirmId = ddlFirm.zIsSelect() ? ddlFirm.zToInt() : (Designation == eDesignation.SystemAdmin ? (int?)null : lblFirmId.zToInt()), MasterSearch = txtSearch.Text, eStatus = Status, eStatusNot = (int)eStatus.Delete, }; #region Page Index int RecordPerPage = ddlRecordPerPage.zToInt().Value; int PageIndexTemp = PageIndex; CU.GetPageIndex(ePageIndex, RecordPerPage, ref PageIndexTemp, ref objQuery, ref txtGotoPageNo, ref lblCount); PageIndex = PageIndexTemp; #endregion Page Index DataTable dtUser = objQuery.Select(eSP.qry_User); #region Count Total lblCount.Text = dtUser.Rows.Count.ToString(); divPaging.Visible = (dtUser.Rows.Count > 0); txtGotoPageNo.Text = PageIndex.ToString(); ltrTotalContent.Text = CU.PageRecordString(lblCount.zToInt().Value, ddlRecordPerPage.zToInt().Value, lnkFirst, lnkPrev, txtGotoPageNo, lnkNext, lnkLast); #endregion dtContact = new Query() { eParentType = (int)eParentType.User, }.Select(eSP.qry_Contacts); grdUser.DataSource = dtUser; grdUser.DataBind(); try { grdUser.HeaderRow.TableSection = TableRowSection.TableHeader; } catch { } }
protected void Page_Load(object sender, EventArgs e) { string url = Request.Url.ToString(); if (url.Contains(emperson)) { Response.Redirect(url.Replace(emperson, "&")); } LoginUtilities.CheckSession(false); Page.Title = Page.Title + " - Shopping Portal"; lblErrorMessage.Text = string.Empty; divSearchResult.Visible = divNoDataFound.Visible = false; if (!IsPostBack) { int OrganizationId = 0; if (!Request.QueryString[CS.OrganizationId.Encrypt()].zIsNullOrEmpty()) { try { OrganizationId = Request.QueryString[CS.OrganizationId.Encrypt()].ToString().Decrypt().zToInt().Value; } catch { } } lblOrganizationId.Text = OrganizationId.ToString(); lbleOrganization.Text = CU.GeteOrganisationId(OrganizationId).zToInt().ToString(); lblFirmId.Text = CU.GetFirmId().ToString(); int UsersId = CU.GetUsersId(); lblViewProductVendor.Text = ((int)eYesNo.No).ToString(); if (UsersId > 0) { eDesignation Designation = CU.GeteDesignationId(UsersId); lbleDesignation.Text = ((int)Designation).ToString(); lblViewProductVendor.Text = CU.GetAuthority(UsersId, eAuthority.ProductVendorView).IsView ? ((int)eYesNo.Yes).ToString() : ((int)eYesNo.No).ToString(); } else { lbleDesignation.Text = "0"; } IsAdmin = lbleDesignation.zToInt() == (int)eDesignation.SystemAdmin || lbleDesignation.zToInt() == (int)eDesignation.Admin; if (!IsAdmin && UsersId > 0) { var objUser = new Users() { UsersId = UsersId }.SelectList <Users>()[0]; lblPriceListId.Text = objUser.PriceListId.HasValue ? objUser.PriceListId.ToString() : "0"; } if (!Request.QueryString["pl"].zIsNullOrEmpty()) { try { PriceListId = Request.QueryString["pl"].ToString().Decrypt().zToInt().Value; } catch { } } if (!Request.QueryString["cp"].zIsNullOrEmpty()) { try { chkPrice.Checked = Convert.ToBoolean(Request.QueryString["cp"].Replace(" ", "")); } catch { } } if (!Request.QueryString["cg"].zIsNullOrEmpty()) { try { chkGlobal.Checked = Convert.ToBoolean(Request.QueryString["cg"].Replace(" ", "")); } catch { } } if (!Request.QueryString["tp"].zIsNullOrEmpty()) { txtProduct.Text = Request.QueryString["tp"].ToString(); } SearchProducts(); } else { IsAdmin = lbleDesignation.zToInt() == (int)eDesignation.SystemAdmin || lbleDesignation.zToInt() == (int)eDesignation.Admin; } aSearchService.HRef = "SearchService.aspx?" + CS.OrganizationId.Encrypt() + "=" + CU.GetOrganizationId().ToString().Encrypt(); aWhatsAppLink.HRef = "https://wa.me/?text=" + Request.Url.ToString().Replace("&", emperson); }
public void LoadUserDetail() { txtName.Focus(); int?UsersId = null, AddressId = null; txtUserName.Enabled = false; divOldPassword.Visible = IsEditMode(); txtOldPassword.Text = string.Empty; lblUserName.Attributes.Add("title", ""); txtPassword.Attributes.Add("ZValidation", "e=blur|v=IsNullRequired|m=Password"); txtConfirmPassword.Attributes.Add("ZValidation", "e=blur|v=IsNullRequired|m=Confirm Password"); int FirmId = 0, OrganizationId = 0, ParentUsersId = 0, PriceListId = 0; if (IsEditMode()) { lblpopupUserTitle.Text = "Edit User"; var dtUser = new Query() { UsersId = lblUsersId.zToInt() }.Select(eSP.qry_User); var objUser = new Users() { }.SelectList <Users>(dtUser.Select())[0]; UsersId = objUser.UsersId; ddlDesignation.SelectedValue = objUser.DesignationId.ToString(); OrganizationId = dtUser.Rows[0][CS.OrganizationId].zToInt().Value; FirmId = objUser.FirmId.Value; ParentUsersId = objUser.ParentUsersId.Value; PriceListId = objUser.PriceListId.Value; txtDescription.Text = objUser.Description; txtName.Text = objUser.Name; txtMobileNo.Text = objUser.MobileNo; txtEmail.Text = objUser.Email; AddressId = objUser.AddressId; lblAddressId.Text = objUser.AddressId.ToString(); var lstLogins = new Logins() { UsersId = objUser.UsersId }.SelectList <Logins>(); if (lstLogins.Count > 0) { txtUserName.Text = lstLogins[0].Username; lblUserName.Attributes.Add("title", LoginUtilities.GetDBPassword(lstLogins[0].Password, lstLogins[0].PwdSalt)); } } else { lblpopupUserTitle.Text = "New User"; txtName.Text = txtMobileNo.Text = txtEmail.Text = txtDescription.Text = lblAddressId.Text = txtUserName.Text = string.Empty; txtUserName.Enabled = true; //ddlDesignation.SelectedValue = ((int)eDesignation.User).ToString(); txtPassword.Text = txtConfirmPassword.Text = string.Empty; txtPassword.Attributes.Add("ZValidation", "e=blur|v=IsRequired|m=Password"); txtConfirmPassword.Attributes.Add("ZValidation", "e=blur|v=IsRequired|m=Confirm Password"); } eDesignation Designation = CU.GeteDesignationId(CU.GetUsersId()); divOrganization.Visible = divFirm.Visible = Designation == eDesignation.SystemAdmin; if (OrganizationId == 0 && Designation != eDesignation.SystemAdmin) { CU.GetFirmOrganizationId(ref FirmId, ref OrganizationId); } LoadOrganization(); ddlOrganization.SelectedValue = OrganizationId.ToString(); LoadFirm(); ddlFirm.SelectedValue = FirmId.ToString(); LoadParentUser(); ddlParentUser.SelectedValue = ParentUsersId.ToString(); LoadPriceList(); ddlPriceList.SelectedValue = PriceListId.ToString(); SetControl(eControl.UserDetail); ManageContact.LoadContactDetail(UsersId, (int)eParentType.User); ManageAddress.LoadAddreessDetail(AddressId, false); }
private void LoadMenu() { #region Load Manu Visible int UsersId = CU.GetUsersId(); var drUser = new Users() { UsersId = UsersId }.Select(new Users() { DesignationId = 0, Name = string.Empty }).Rows[0]; eDesignation Designation = CU.GetDesiToeDesi(drUser[CS.DesignationId].zToInt().Value); #region Load Detail lblClientName.Text = drUser[CS.Name].ToString(); imgClientImage.ImageUrl = CU.GetFilePath(true, ePhotoSize.W50xH50, eFolder.UserProfile, UsersId.ToString(), true); imgLogo.ImageUrl = CU.GetSystemImage(eSystemImage.OCTFISLogo_EXT_png); #endregion if (Designation != eDesignation.SystemAdmin) { var dtUserAuthority = new UserAuthority() { UsersId = UsersId, IsAllowView = true, }.Select(new UserAuthority() { eAuthority = 0, IsAllowAddEdit = true, IsAllowView = true }); #region Configuration liManageCountry.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCountry).Length > 0; liManageState.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageState).Length > 0; liManageCity.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCity).Length > 0; liManageArea.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageArea).Length > 0; liManageServiceAvailability.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageService).Length > 0; liManageBankAccount.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageBankAccount).Length > 0; liManageVariant.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageVariant).Length > 0; liManagePriceList.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManagePriceList).Length > 0; liManageCourier.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCourier).Length > 0; liManageOrderStatus.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrderStatus).Length > 0; liManageOrderSource.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrderSource).Length > 0; liManageVendor.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageVendor).Length > 0; liConfiguration.Visible = Designation == eDesignation.SystemAdmin || Designation == eDesignation.Admin; if (!liManageCountry.Visible && !liManageState.Visible && !liManageCity.Visible && !liManageArea.Visible && !liManageBankAccount.Visible && !liManageVariant.Visible && !liManagePriceList.Visible && !liManageCourier.Visible && !liManageOrderStatus.Visible && !liManageOrderSource.Visible && !liConfiguration.Visible) { ulConfiguration.Visible = false; } #endregion #region System liManageDesignation.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Designation).Length > 0; liManageOrganization.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Organization).Length > 0; liManageFirm.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Firm).Length > 0; liManageUser.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.User).Length > 0; if (!liManageDesignation.Visible && !liManageOrganization.Visible && !liManageFirm.Visible && !liManageUser.Visible && !liManageCustomer.Visible) { ulSystem.Visible = false; } #endregion #region Product liManagePortal.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManagePortal).Length > 0; liManageProduct.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageProduct).Length > 0; liManageAdjustment.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Adjustment).Length > 0; if (!liManagePortal.Visible && !liManageProduct.Visible && !liManageAdjustment.Visible) { liProduct.Visible = false; } #endregion #region Order liOrderView.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrder).Length > 0; liManageOrder.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrder + " AND " + CS.IsAllowAddEdit + " = " + true).Length > 0; liManageOrderPayment.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrderPayment).Length > 0; if (!liManageOrder.Visible && !liOrderView.Visible && !liManageOrderPayment.Visible) { liManageOrderPage.Visible = false; } #endregion liViewCart.Visible = false; #region Call Recording liManageCallType.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCallType).Length > 0; liManageCallHistory.Visible = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCallHistory).Length > 0; if (!liManageCallType.Visible && !liManageCallHistory.Visible) { liCallRecording.Visible = false; } #endregion string PageName = Request.Url.AbsolutePath.ToLower(); PageName = PageName.Substring(PageName.LastIndexOf("/") + 1); bool IsValid = false; switch (PageName) { case "home.aspx": case "myprofile.aspx": case "managecustomer.aspx": case "manageonlinecurior.aspx": case "mywallet.aspx": IsValid = true; break; #region Configuration case "managecountry.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCountry).Length > 0; break; case "managestate.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageState).Length > 0; break; case "managecity.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCity).Length > 0; break; case "managearea.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageArea).Length > 0; break; case "manageserviceavailability.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageService).Length > 0; break; case "managebankaccount.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageBankAccount).Length > 0; break; case "managevariant.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageVariant).Length > 0; break; case "managepricelist.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManagePriceList).Length > 0; break; case "managecourier.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCourier).Length > 0; break; case "manageordersource.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrderSource).Length > 0; break; case "manageorderstatus.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrderStatus).Length > 0; break; case "managevendor.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageVendor).Length > 0; break; #endregion #region System case "managedesignation.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Designation).Length > 0; break; case "manageorganization.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Organization).Length > 0; break; case "managefirm.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Firm).Length > 0; break; case "manageuser.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.User).Length > 0; break; #endregion #region Product case "manageportal.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManagePortal).Length > 0; break; case "manageproduct.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageProduct).Length > 0; break; case "manageadjustment.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.Adjustment).Length > 0; break; #endregion #region Order case "orderview.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrder).Length > 0; break; case "manageorder.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrder + " AND " + CS.IsAllowAddEdit + " = " + true).Length > 0; break; case "manageorderpayment.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageOrderPayment).Length > 0; break; #endregion #region Call Recording case "managecalltype.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCallType).Length > 0; break; case "managecallhistory.aspx": IsValid = dtUserAuthority.Select(CS.eAuthority + " = " + (int)eAuthority.ManageCallHistory).Length > 0; break; #endregion case "configuration.aspx": IsValid = (Designation == eDesignation.SystemAdmin || Designation == eDesignation.Admin); break; } if (!IsValid) { Response.Redirect("Home.aspx"); } } #endregion }