Пример #1
0
    protected void grdPriceList_OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (!IsAddEdit.HasValue)
            {
                IsAddEdit = CU.GetAuthority(CU.GetUsersId(), eAuthority.ManagePriceList).IsAddEdit;
            }

            if (IsAddEdit.Value)
            {
                e.Row.Attributes["ondblclick"] = Page.ClientScript.GetPostBackClientHyperlink(grdPriceList, "Select$" + e.Row.RowIndex);
            }

            if (Convert.ToInt32(e.Row.Cells[CU.GetColumnIndexByName(grdPriceList, CS.eStatus)].Text) != (int)eStatus.Active)
            {
                e.Row.Attributes["class"] = "GridDesableRow ";
            }

            DataRowView dataItem         = (DataRowView)e.Row.DataItem;
            var         lnkEditPriceList = e.Row.FindControl("lnkEditPriceList") as LinkButton;
            var         ltrPriceList     = e.Row.FindControl("ltrPriceList") as Literal;
            var         aPriceListId     = e.Row.FindControl("aPriceListId") as HtmlAnchor;


            lnkEditPriceList.Visible = IsAddEdit.Value;
            ltrPriceList.Visible     = !IsAddEdit.Value;

            lnkEditPriceList.Text            = ltrPriceList.Text = dataItem[CS.PriceListName].ToString();
            lnkEditPriceList.CommandArgument = dataItem[CS.PriceListId].ToString();

            aPriceListId.InnerText = dataItem[CS.PriceListId].ToString().Encrypt();
            aPriceListId.HRef      = "SearchProduct.aspx?pl=" + aPriceListId.InnerText + "&" + CS.OrganizationId.Encrypt() + "=" + CU.GetOrganizationId().ToString().Encrypt();
        }
    }
    protected void btnExport_OnClick(object sender, EventArgs e)
    {
        DataTable     dtExport   = ((DataTable)Session["dtExport"]);
        List <string> ColumnList = new List <string>();

        foreach (RepeaterItem item in rptExportColumn.Items)
        {
            var chkExportColumn = item.FindControl("chkExportColumn") as CheckBox;
            if (chkExportColumn.Checked)
            {
                ColumnList.Add(chkExportColumn.Text);
            }
        }

        if (ColumnList.Count == 0)
        {
            CU.ZMessage(eMsgType.Error, string.Empty, "Please Select Export Field.");
            return;
        }

        dtExport = dtExport.DefaultView.ToTable(false, ColumnList.ToArray());


        //string FileName = lblFileName.Text + "_" + CU.GetDateTimeName();
        //Session[FileName] = dtExport;
        //System.Web.UI.ScriptManager.RegisterStartupScript(Page, typeof(System.Web.UI.Page), "OpenWindow", "OpenNewWindow('ExcelExport.aspx?" + "FileName".Encrypt() + "=" + FileName.Encrypt() + "');", true);

        string FileName = lblFileName.Text + "_" + CU.GetDateTimeName() + ".xls";

        CU.ExportToExcel(Server.MapPath(CU.GettempDownloadPath()) + "/" + FileName, dtExport);
        System.Web.UI.ScriptManager.RegisterStartupScript(Page, typeof(System.Web.UI.Page), "OpenWindow", "OpenNewWindow('" + CU.GettempDownloadPath() + "/" + FileName + "');", true);
    }
    protected void lnkDeactive_OnClick(object sender, EventArgs e)
    {
        if (grdVariant.zIsValidSelection(lblVariantId, "chkSelect", CS.VariantId))
        {
            if (new Variant()
            {
                VariantId = lblVariantId.zToInt(),
                eStatus = (int)eStatus.Deactive
            }.SelectCount() > 0)
            {
                CU.ZMessage(eMsgType.Error, string.Empty, "This Variant is already Deactive.");
                return;
            }

            string Message = string.Empty;
            if (CU.IsVariantUsed(lblVariantId.zToInt().Value, ref Message))
            {
                CU.ZMessage(eMsgType.Error, string.Empty, Message + ", Then It can not Deactive.");
                return;
            }

            Confirmationpopup.SetPopupType(ePopupType.Deactive, "Deactive Variant", "Are You Sure To Deactive Variant?");
            popupConfirmation.Show();
        }
    }
    protected void grdDesignation_OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (!IsAddEdit.HasValue)
            {
                IsAddEdit = CU.GetAuthority(CU.GetUsersId(), eAuthority.Designation).IsAddEdit;
            }
            if (IsAddEdit.Value)
            {
                e.Row.Attributes["ondblclick"] = Page.ClientScript.GetPostBackClientHyperlink(grdDesignation, "Select$" + e.Row.RowIndex);
            }

            if (Convert.ToInt32(e.Row.Cells[CU.GetColumnIndexByName(grdDesignation, CS.eStatus)].Text) != (int)eStatus.Active)
            {
                e.Row.Attributes["class"] = "GridDesableRow ";
            }

            DataRowView dataItem           = (DataRowView)e.Row.DataItem;
            var         lnkEditDesignation = e.Row.FindControl("lnkEditDesignation") as LinkButton;
            var         ltrDesignation     = e.Row.FindControl("ltrDesignation") as Literal;

            lnkEditDesignation.Visible = IsAddEdit.Value;
            ltrDesignation.Visible     = !IsAddEdit.Value;

            lnkEditDesignation.Text            = ltrDesignation.Text = dataItem[CS.DesignationName].ToString();
            lnkEditDesignation.CommandArgument = dataItem[CS.DesignationId].ToString();
        }
    }
    private void LoadDesignationGrid(ePageIndex ePageIndex)
    {
        DataTable dtDesignation = GetDesignationDt(ePageIndex);

        if (dtDesignation.Rows.Count > 0)
        {
            lblCount.Text = dtDesignation.Rows[0][CS.TotalRecord].ToString();
        }
        else
        {
            lblCount.Text = "0";
        }

        divPaging.Visible = (dtDesignation.Rows.Count > 0);

        txtGotoPageNo.Text = PageIndex.ToString();

        ltrTotalContent.Text = CU.PageRecordString(lblCount.zToInt().Value, ddlRecordPerPage.zToInt().Value, lnkFirst, lnkPrev, txtGotoPageNo, lnkNext, lnkLast);

        grdDesignation.DataSource = dtDesignation;
        grdDesignation.DataBind();

        try { grdDesignation.HeaderRow.TableSection = TableRowSection.TableHeader; }
        catch { }
    }
Пример #6
0
    private DataTable GetOnlineCourierDt(ePageIndex ePageIndex)
    {
        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()
        {
            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

        return(objQuery.Select(eSP.qry_OnlineCourier));
    }
Пример #7
0
    private DataTable GetOrderPaymentDt(ePageIndex ePageIndex)
    {
        var objQuery = new Query()
        {
            OrganizationId = lblOrganizationId.zToInt(),

            FirmId   = ddlFirm.zToInt() > 0 ? ddlFirm.zToInt() : (int?)null,
            UsersId  = ddlUser.zToInt() > 0 ? ddlUser.zToInt() : (int?)null,
            OrdersId = txtSearchOrderId.zToInt(),
            FromDate = txtFromDate.zToDate().HasValue ? txtFromDate.zToDate() : (DateTime?)null,
            ToDate   = txtToDate.zToDate().HasValue ? txtToDate.zToDate().Value.AddDays(1).AddSeconds(-1) : (DateTime?)null,

            MasterSearch = txtSearch.Text,
        };

        #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

        return(objQuery.Select(eSP.qry_OrderPayment));
    }
Пример #8
0
    private bool SaveData()
    {
        if (!IsValidate())
        {
            return(false);
        }

        string Message = string.Empty;

        var objPriceList = new PriceList()
        {
            FirmId        = lblFirmId.zToInt(),
            PriceListName = txtPriceListName.Text.Trim().zFirstCharToUpper(),
        };

        if (IsEditMode())
        {
            objPriceList.PriceListId = lblPriceListId.zToInt();
            objPriceList.Update();

            Message = "PriceList Detail Change Sucessfully.";
        }
        else
        {
            objPriceList.eStatus = (int)eStatus.Active;
            objPriceList.Insert();

            Message = "New PriceList Added Sucessfully.";
        }

        CU.ZMessage(eMsgType.Success, string.Empty, Message);

        return(true);
    }
Пример #9
0
    private bool IsValidate()
    {
        if (txtPriceListName.zIsNullOrEmpty())
        {
            CU.ZMessage(eMsgType.Error, string.Empty, "Please Enter PriceList Name.");
            txtPriceListName.Focus();
            return(false);
        }

        var dt = new Query()
        {
            eStatusNot    = (int)eStatus.Delete,
            FirmId        = lblFirmId.zToInt(),
            PriceListName = txtPriceListName.Text.Trim()
        }.Select(eSP.qry_PriceList);

        if (dt.Rows.Count > 0 && dt.Rows[0][CS.PriceListId].ToString() != lblPriceListId.Text)
        {
            string Status = dt.Rows[0][CS.eStatus].zToInt().Value == (int)eStatus.Deactive ? "(Deactive)" : string.Empty;
            CU.ZMessage(eMsgType.Error, string.Empty, "This PriceList is already exist" + Status + ".");
            txtPriceListName.Focus();
            return(false);
        }

        return(true);
    }
Пример #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LoginUtilities.CheckSession();
        if (!IsPostBack)
        {
            SetControl(eControl.PriceList);

            int FirmId = 0, OrganizationId = 0;
            CU.GetFirmOrganizationId(ref FirmId, ref OrganizationId);
            lblFirmId.Text         = FirmId.ToString();
            lblOrganizationId.Text = OrganizationId.ToString();

            CU.LoadDisplayPerPage(ref ddlRecordPerPage);

            LoadPriceListGrid(ePageIndex.Custom);
            CheckVisibleButton();
        }

        Confirmationpopup.btnActivePopup_OnClick   += new EventHandler(btnActive_OnClick);
        Confirmationpopup.btnDeactivePopup_OnClick += new EventHandler(btnDeactive_OnClick);
        Confirmationpopup.btnDeletePopup_OnClick   += new EventHandler(btnDelete_OnClick);

        try { grdPriceList.HeaderRow.TableSection = TableRowSection.TableHeader; }
        catch { }
    }
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.Firm).IsAddEdit&& (sender == null || grdFirm.zIsValidSelection(lblFirmId, "chkSelect", CS.FirmId)))
     {
         LoadFirmDetail();
         popupFirm.Show();
     }
 }
        public VM()
        {
            registerMemory = new RegisterMemory();
            ALU alu = new ALU(registerMemory);
            CU  cu  = new CU(registerMemory, alu);

            os = new OS(cu, registerMemory);
        }
Пример #13
0
        public TWMCUPOINT_EST MapObjectToEntity(CU obj)
        {
            TWMCUPOINT_EST entity = new TWMCUPOINT_EST();

            entity = MapRootObjectToEntity(obj, entity);

            return(entity);
        }
 protected void lnkEditValue_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.ManageVariant).IsAddEdit&& (sender == null || grdVariantValue.zIsValidSelection(lblVariantValueId, "chkSelect", CS.VariantValueId)))
     {
         LoadVariantValueDetail();
         popupVariantValue.Show();
     }
 }
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.ManageBankAccount).IsAddEdit&& (sender == null || grdBankAccount.zIsValidSelection(lblBankAccountId, "chkSelect", CS.BankAccountId)))
     {
         LoadBankAccountDetail();
         popupBankAccount.Show();
     }
 }
Пример #16
0
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.ManageCallHistory).IsAddEdit&& (sender == null || grdCallHistory.zIsValidSelection(lblCallHistoryId, "chkSelect", CS.CallHistoryId)))
     {
         LoadCallHistoryDetail();
         popupCallHistory.Show();
     }
 }
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.ManageVendor).IsAddEdit&& (sender == null || grdVendor.zIsValidSelection(lblVendorId, "chkSelect", CS.VendorId)))
     {
         LoadVendorDetail();
         popupVendor.Show();
     }
 }
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.Organization).IsAddEdit&& (sender == null || grdOrganization.zIsValidSelection(lblOrganizationId, "chkSelect", CS.OrganizationId)))
     {
         LoadOrganizationDetail();
         popupOrganization.Show();
     }
 }
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.ManagePortal).IsAddEdit&& (sender == null || grdPortal.zIsValidSelection(lblPortalId, "chkSelect", CS.PortalId)))
     {
         LoadPortalDetail();
         popupPortal.Show();
     }
 }
Пример #20
0
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.ManageCountry).IsAddEdit&& (sender == null || grdService.zIsValidSelection(lblServiceAvailabilityId, "chkSelect", CS.ServiceAvailabilityId)))
     {
         LoadServiceDetail();
         popupService.Show();
     }
 }
    private void InsertData(DataTable dt)
    {
        int UpdateCount = 0, InsertCount = 0;

        try
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                #region Value Initialization

                CountryName = dt.Rows[i][CountryNameColumn].ToString().Trim();
                StateName   = dt.Rows[i][StateNameColumn].ToString().Trim();
                Description = dt.Rows[i][DescriptionColumn].ToString().Trim();

                #endregion

                var objCountry = new Country()
                {
                    CountryName = CountryName.ToLower(), eStatus = (int)eStatus.Active
                }.SelectList <Country>()[0];

                DataTable dtState = new Query()
                {
                    CountryId  = objCountry.CountryId,
                    StateName  = StateName,
                    eStatusNot = (int)eStatus.Delete
                }.Select(eSP.qry_State);

                var objState = new State()
                {
                    CountryId   = objCountry.CountryId,
                    StateId     = dtState.Rows.Count > 0 ? dtState.Rows[0][CS.StateId].zToInt() : (int?)null,
                    StateName   = StateName.zFirstCharToUpper(),
                    Description = Description,
                };

                if (objState.StateId.HasValue)
                {
                    objState.Update();
                    UpdateCount++;
                }
                else
                {
                    objState.eStatus = (int)eStatus.Active;
                    objState.Insert();
                    InsertCount++;
                }
            }

            CU.SetSuccessExcelMessage(InsertCount, UpdateCount, "State");
        }
        catch (Exception ex)
        {
            CU.ZMessage(eMsgType.Error, string.Empty, ex.Message, 0);
        }

        LoadStateGrid(ePageIndex.Custom);
    }
    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 { }
    }
Пример #23
0
    private bool SaveData()
    {
        if (!IsValidate())
        {
            return(false);
        }

        lblAddressId.Text = ManageAddress.SaveAddress(lblAddressId.zToInt()).ToString();

        string Message = string.Empty;
        int?   UsersId = null;
        var    objUser = new Users()
        {
            FirmId        = ddlFirm.zToInt(),
            Name          = txtName.Text,
            AddressId     = lblAddressId.zToInt(),
            DesignationId = ddlDesignation.zToInt(),
            MobileNo      = txtMobileNo.Text.Trim(),
            ParentUsersId = ddlParentUser.zToInt(),
            PriceListId   = ddlPriceList.zToInt(),           //??
            Email         = txtEmail.Text,
            Description   = txtDescription.Text,
        };

        if (IsEditMode())
        {
            UsersId         = lblUsersId.zToInt();
            objUser.UsersId = UsersId;
            objUser.Update();

            Message = "User Detail Change Sucessfully";

            if (!txtPassword.zIsNullOrEmpty())
            {
                LoginUtilities.ChangePassword(UsersId.Value, txtPassword.Text);
            }
        }
        else
        {
            objUser.eStatus = (int)eStatus.Active;
            UsersId         = objUser.Insert();

            LoginUtilities.CreateLogin(UsersId.Value, txtUserName.Text.ToLower(), txtPassword.Text);

            CU.SetDefaultAuthority(UsersId.Value, objUser.DesignationId.Value);

            Message = "User Added Sucessfully";
        }

        ManageContact.SaveContactDetail(UsersId.Value, (int)eParentType.User);

        lblUsersId.Text = UsersId.ToString();

        CU.ZMessage(eMsgType.Success, string.Empty, Message);

        SetUsersId = string.Empty;
        return(true);
    }
 protected void btnDelete_OnClick(object sender, EventArgs e)
 {
     new Users()
     {
         UsersId = txtUsersId.zToInt(), eStatus = (int)eStatus.Delete
     }.Update();
     CU.ZMessage(eMsgType.Success, string.Empty, "User Deleted Successfully");
     LoadUserGrid(ePageIndex.Custom);
 }
Пример #25
0
    private void LoadPriceList()
    {
        var dtPriceList = new Query()
        {
            FirmId = ddlFirm.zToInt(), eStatus = (int)eStatus.Active
        }.Select(eSP.qry_PriceList);

        CU.FillDropdown(ref ddlPriceList, dtPriceList, "-- Price List --", CS.PriceListId, CS.PriceListName);
    }
Пример #26
0
    private void LoadParentUser()
    {
        var dtUser = new Query()
        {
            FirmId = ddlFirm.zToInt(), eStatus = (int)eStatus.Active
        }.Select(eSP.qry_User);

        CU.FillDropdown(ref ddlParentUser, dtUser, "-- Parent User --", CS.UsersId, CS.Name);
    }
Пример #27
0
    private void LoadFirm()
    {
        var dtFirm = new Query()
        {
            OrganizationId = ddlOrganization.zToInt(), eStatus = (int)eStatus.Active
        }.Select(eSP.qry_Firm);

        CU.FillDropdown(ref ddlFirm, dtFirm, "-- Select Firm --", CS.FirmId, CS.FirmName);
    }
Пример #28
0
    private void LoadOrganization()
    {
        var dtOrganization = new Query()
        {
            eStatus = (int)eStatus.Active
        }.Select(eSP.qry_Organization);

        CU.FillDropdown(ref ddlOrganization, dtOrganization, "-- Select Organization --", CS.OrganizationId, CS.OrganizationName);
    }
Пример #29
0
 protected void btnDeactive_OnClick(object sender, EventArgs e)
 {
     new Customer()
     {
         CustomerId = txtCustomerId.zToInt(), eStatus = (int)eStatus.Deactive
     }.Update();
     CU.ZMessage(eMsgType.Success, string.Empty, "Customer Deactivet Successfully");
     LoadCustomerGrid(ePageIndex.Custom);
 }
Пример #30
0
 protected void lnkEdit_OnClick(object sender, EventArgs e)
 {
     if (CU.GetAuthority(CU.GetUsersId(), eAuthority.ManageArea).IsAddEdit&& (sender == null || grdArea.zIsValidSelection(lblAreaId, "chkSelect", CS.AreaId)))
     {
         popupManageArea.SetAreaId = lblAreaId.Text;
         popupManageArea.LoadAreaDetail(false);
         popupArea.Show();
     }
 }