Exemplo n.º 1
0
        private void btnAddArticle_Click(object sender, EventArgs e)
        {
            try
            {
                bool isValid = true;
                if (!CommonFunc.SetErrorProvidertoControlForWindowsForm(ref Itemerrorprovider, ref cmbStockOutReason, "Stock Out Reason required"))
                {
                    this.cmbStockOutReason.Focus();
                    isValid = false;
                }
                if ((string)cmbStockOutReason.SelectedValue == "SupplierReturn" || (string)cmbStockOutReason.SelectedValue == "WriteOff")
                {
                    if (!CommonFunc.SetErrorProvidertoControlForWindowsForm(ref Itemerrorprovider, ref cmbFromLocation, "From Location Reason required"))
                    {
                        this.cmbFromLocation.Focus();
                        isValid = false;
                    }
                }

                if (!isValid)
                {
                    return;
                }
                string supplierCode = "";
                if (cmbSupplierName.SelectedValue != null)
                {
                    supplierCode = (cmbSupplierName.SelectedValue != "Select") ? cmbSupplierName.SelectedValue.ToString() : string.Empty;
                }
                var articleList = this.articleManager.GetArticlePurchaseList(supplierCode);



                frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid(multipleSelect: true, defaultFilter: false);
                DataTable dtItems = CommonFunc.ConvertListToDataTable(articleList);

                objSearch.Text           = "Item Search";
                objSearch.boolWildSearch = true;
                objSearch.dtcommonSearch = dtItems;
                DataTable dtSelectedItems = new DataTable();

                if (objSearch.ShowDialog() == DialogResult.OK)
                {
                    dtSelectedItems = objSearch.dtSelectedList;
                    //  List<ArticlePurchaseModel> selectedIArticleList = DataTableToList.ConvertDataTableToList<ArticlePurchaseModel>(dtSelectedItems);
                    List <ArticlePurchaseStockoutModel> selectedIArticleList = DataTableToList.ToList <ArticlePurchaseStockoutModel>(dtSelectedItems);

                    AddSelectedArticlesIntoGrid(selectedIArticleList);
                }
                objSearch.Dispose();
            }
            catch (Exception ex)
            {
                CommonFunc.ShowMessage(ex.Message, MessageType.Information);
                Logger.Log(ex.Message, Logger.LogingLevel.Error);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddArticle_Click(object sender, EventArgs e)
        {
            try
            {
                string supplierCode = (cmbSupplierName.SelectedValue != null) ? cmbSupplierName.SelectedValue.ToString() : string.Empty;
                var    articleList  = this.articleManager.GetArticlePurchaseList(supplierCode, new List <string>());


                if (articleList.Count > 0)
                {
                    frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid(multipleSelect: true, defaultFilter: false);
                    DataTable dtItems = CommonFunc.ConvertListToDataTable(articleList);


                    objSearch.Text           = "Item Search";
                    objSearch.boolWildSearch = true;
                    objSearch.dtcommonSearch = dtItems;
                    DataTable dtSelectedItems = new DataTable();

                    if (objSearch.ShowDialog() == DialogResult.OK)
                    {
                        dtSelectedItems = objSearch.dtSelectedList;
                        //  List<ArticlePurchaseModel> selectedIArticleList = DataTableToList.ConvertDataTableToList<ArticlePurchaseModel>(dtSelectedItems);
                        if (dtSelectedItems != null)
                        {
                            List <ArticlePurchaseModel> selectedIArticleList = DataTableToList.ToList <ArticlePurchaseModel>(dtSelectedItems);

                            AddSelectedArticlesIntoGrid(selectedIArticleList);
                        }
                    }
                    objSearch.Dispose();
                }
                else
                {
                    CommonFunc.ShowMessage("Article not exist", MessageType.Information);
                }

                //frmCommonSearch objSearch = new frmCommonSearch(true);
                //objSearch.DataList = articleList;
            }
            catch (Exception ex)
            {
                CommonFunc.ShowMessage(ex.Message, MessageType.Information);
                Logger.Log(ex.Message, Logger.LogingLevel.Error);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///  on search click it will open search box of all supplier ...and after selecting the supplier , fecth supplier details and bind to supplier model .
        /// </summary>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                var supplierList = this.supplierManager.GetSupplierList().ToList();

                frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid(multipleSelect: false);
                DataTable dtSupplier = CommonFunc.ConvertListToDataTable(supplierList);

                objSearch.Text           = "Supplier Search";
                objSearch.boolWildSearch = false;
                objSearch.dtcommonSearch = dtSupplier;
                DataTable dtSelectedSupplier = new DataTable();

                if (objSearch.ShowDialog() == DialogResult.OK)
                {
                    dtSelectedSupplier = objSearch.dtSelectedList;
                    if (dtSelectedSupplier.Rows.Count > 0)
                    {
                        editSupplierCode   = dtSelectedSupplier.Rows[0]["Code"].ToString();
                        this.supplierModel = this.supplierManager.GetSupplierByID(editSupplierCode);

                        FillModelDataToSupplier();
                        //For Edit Supplier, all the fields except supplier code are editable.
                        txtSupplierCode.ReadOnly = true;
                        //code added by irfan on 14-7-2017 issue id 0002254
                        supplierErrorProvider.SetError(txtContactPerson, string.Empty);
                        supplierErrorProvider.SetError(txtName, string.Empty);

                        txtContactPerson.BorderColor = CommonFunc.DefaultBorderColor;
                        txtName.BorderColor          = CommonFunc.DefaultBorderColor;
                    }
                }
                objSearch.Dispose();
            }
            catch (Exception ex)
            {
                Logger.Log(ex, Logger.LogingLevel.Error);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lnkFailedArticles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                if (faildArticlesList.ToList().Count > 0)
                {
                    DataTable dtExport = CommonFunc.ConvertListToDataTable(faildArticlesList.ToList());

                    dtExport.Columns[0].ColumnName = "Article Code";
                    dtExport.Columns[1].ColumnName = "Quantity";


                    Cursor.Current = Cursors.WaitCursor;
                    DialogResult resultShow = fbd.ShowDialog();
                    if (resultShow == DialogResult.OK)
                    {
                        string path       = Path.Combine(fbd.SelectedPath, "FailedArticel" + DateTime.Now.ToString("dd-MM-yyyy-hhmm") + ".xls").ToString();
                        bool   IsExported = ConvertListToExcel.DatatableToExcel(dtExport, path);
                        System.Diagnostics.Process.Start(path);
                        if (IsExported)
                        {
                            MessageBox.Show("Exported Successfully");
                        }
                    }
                    Cursor.Current = Cursors.Default;
                }
                else
                {
                    CommonFunc.ShowMessage("Failed Articles does not exist", MessageType.Information);
                }
            }


            catch (Exception ex)
            {
                Logger.Log(ex, Logger.LogingLevel.Error);
                throw ex;
            }
        }
Exemplo n.º 5
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                ArticleManager         articleHierarchyManager = new ArticleManager();
                ArticleDataExportModel articleDataExportModel  = articleHierarchyManager.GetArticlesForBarcodeExportData(NodeCode, CommonModel.SiteCode);
                if (cboBarCodeType.SelectedValue != null)
                {
                    // articleDataExportModel.ArticleDetails = articleDataExportModel.ArticleDetails.Where(x => x.DISCRIPTION == cboBarCodeType.SelectedValue.ToString()).ToList();
                    articleDataExportModel.ArticleDetails = articleDataExportModel.ArticleDetails.Where(x => x.BarcodeType == cboBarCodeType.SelectedValue.ToString()).ToList();  //vipin
                }
                var barCodeList = (from result in articleDataExportModel.ArticleDetails
                                   select new BarcodeModelExcel
                {
                    ArticleName = result.ArticleName,
                    ArticleCode = result.ArticleCode,
                    // BARCODE = result.EAN,
                    BARCODE = result.Barcode,                     // added by vipin
                    SellingPrice = result.SellingPrice,
                    MRP = result.MRP,
                    UOM = result.BaseUoM,
                    NetWeight = result.NetWeight,
                    ExpiryDate = ""
                }).ToList();
                DataTable dtExport = CommonFunc.ConvertListToDataTable(barCodeList);

                dtExport.Columns[0].ColumnName = "Article Name";
                dtExport.Columns[1].ColumnName = "Article Code";
                dtExport.Columns[2].ColumnName = "BARCODE";
                dtExport.Columns[3].ColumnName = "Selling Price";
                dtExport.Columns[4].ColumnName = "MRP";
                dtExport.Columns[5].ColumnName = "UOM";
                dtExport.Columns[6].ColumnName = "Net Weight";
                dtExport.Columns[7].ColumnName = "Expiry Date";
                dtExport.Columns.Add("IsExclude");

                var deleteArticleCodeRow = new List <ItemExclude>();
                for (int i = 1; i < gridBarcode.Rows.Count - 1; i++)
                {
                    ItemExclude itemExclude = new ItemExclude();
                    if (gridBarcode.Rows[i][(int)enumBarcode.Exclude].ToString().ToLower() == "true")
                    {
                        itemExclude.ArticleCode = gridBarcode.Rows[i][(int)enumBarcode.ItemCode].ToString();
                        deleteArticleCodeRow.Add(itemExclude);
                    }
                }


                foreach (DataRow dr in dtExport.Rows)
                {
                    foreach (var item in deleteArticleCodeRow)
                    {
                        if (dr["Article Code"].ToString() == item.ArticleCode)
                        {
                            dr["IsExclude"] = "Exclude";
                            break;
                        }
                        else
                        {
                            dr["IsExclude"] = "Include";
                        }
                    }
                }
                DataView dv = new DataView(dtExport);
                dv.RowFilter = "IsExclude = 'Include'";
                DataTable dt = new DataTable();
                dt = dv.ToTable();
                dt.Columns.Remove("IsExclude");
                Cursor.Current = Cursors.WaitCursor;
                DialogResult resultShow = fbd.ShowDialog();
                if (resultShow == DialogResult.OK)
                {
                    string path       = Path.Combine(fbd.SelectedPath, "ArticelHierarchy" + DateTime.Now.ToString("dd-MM-yyyy-hhmm") + ".xls").ToString();
                    bool   IsExported = ConvertListToExcel.DatatableToExcel(dt, path);
                    System.Diagnostics.Process.Start(path);
                    if (IsExported)
                    {
                        MessageBox.Show("Exported Successfully");
                    }
                }
                Cursor.Current = Cursors.Default;
            }
            catch (System.Exception ex)
            {
                CommonFunc.ShowMessage(ex.Message, MessageType.Information);
                Logger.Log(ex.Message, Logger.LogingLevel.Error);
            }
        }
Exemplo n.º 6
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                txtPromotionId.ReadOnly = false;
                //AuthUserModelEdit userSelectedList = null;
                var promoList = this.promotionManager.GetManualPromotions();
                if (promoList != null && promoList.Count > 0)
                {
                    //frmCommonSearch objSearch = new frmCommonSearch();
                    //objSearch.DataList = userList;
                    frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid();
                    objSearch.Text = "Promotion Search";
                    DataTable dtPromotion = CommonFunc.ConvertListToDataTable(promoList);

                    // dtPromotion.Columns[0].ColumnName = "All";
                    dtPromotion.Columns[0].ColumnName = "Promotion Id";
                    dtPromotion.Columns[1].ColumnName = "Promotion Name";
                    dtPromotion.Columns[2].ColumnName = "Promotion Value";
                    dtPromotion.Columns[0].Caption    = "PromotionId";
                    dtPromotion.Columns[1].Caption    = "PromotionName";
                    dtPromotion.Columns[2].Caption    = "PromotionValue";

                    objSearch.dtcommonSearch = dtPromotion;
                    DataTable dtSelectedPromotion = new DataTable();
                    if (objSearch.ShowDialog() == DialogResult.OK)
                    {
                        dtSelectedPromotion = objSearch.dtSelectedList;
                    }
                    //userSelectedList = (objSearch.neTbl).Cast<AuthUserModelEdit>().FirstOrDefault();

                    if (dtSelectedPromotion.Rows.Count > 0)
                    {
                        var promotionDetail = this.promotionManager.GetPromotionById(dtSelectedPromotion.Rows[0]["Promotion Id"].ToString());

                        txtPromotionId.Text     = promotionDetail.PromotionId;
                        txtPromotionId.ReadOnly = true;
                        txtPromotionName.Text   = promotionDetail.PromotionName;
                        txtPromotionValue.Text  = promotionDetail.PromotionValue.ToString();

                        if (promotionDetail.IsApproved == true)
                        {
                            chkPromoActive.Checked = true;
                        }
                        else
                        {
                            chkPromoActive.Checked = false;
                        }
                        if (promotionDetail.FixedSelling == true)
                        {
                            rdbFlatPrice.Checked = true;
                        }
                        else if (promotionDetail.FixedPriceOff == true)
                        {
                            rdoAmountOff.Checked = true;
                        }
                        else if (promotionDetail.DiscPer == true)
                        {
                            rdoDiscountPer.Checked = true;
                        }


                        flagAddEdit = true;
                    }
                    else
                    {
                        txtPromotionId.ReadOnly = true;
                    }
                    objSearch.Dispose();
                }
                else
                {
                    CommonFunc.ShowMessage("No Records to display.", MessageType.Information);
                }
            }
            catch (Exception ex)
            {
                CommonFunc.ShowMessage(ex.Message, MessageType.Information);
                Logger.Log(ex.Message, Logger.LogingLevel.Error);
            }
        }
Exemplo n.º 7
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                txtSiteCode.ReadOnly      = false;
                finYearBeginDate.ReadOnly = false;
                finYearEndDate.ReadOnly   = false;
                txtCountry.ReadOnly       = false;
                txtCurrencyCode.ReadOnly  = false;
                txtCurrencySymol.ReadOnly = false;
                clearForm();
                var siteList = this.siteManager.GetSiteEditList().ToList();
                frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid();
                objSearch.Text = "Site Search";
                DataTable dtSites = CommonFunc.ConvertListToDataTable(siteList);

                //dtUser.Columns[0].ColumnName = "s";
                dtSites.Columns[0].ColumnName = "Site Code";
                dtSites.Columns[1].ColumnName = "Site Name";
                dtSites.Columns[2].ColumnName = "Contact Person";
                dtSites.Columns[3].ColumnName = "Email Address";

                objSearch.dtcommonSearch = dtSites;
                DataTable dtSelectedSite = new DataTable();
                if (objSearch.ShowDialog() == DialogResult.OK)
                {
                    dtSelectedSite = objSearch.dtSelectedList;
                }
                if (dtSelectedSite.Rows.Count > 0)
                {
                    var siteDetail          = this.siteManager.GetSiteByID(dtSelectedSite.Rows[0]["Site Code"].ToString());
                    var finYearDetails      = this.siteManager.GetFinYearDetailsBySiteID(dtSelectedSite.Rows[0]["Site Code"].ToString());
                    var siteCurrencyDetails = this.siteManager.GetCurrencySymbol(siteDetail.LocalCurrancyCode);

                    txtSiteCode.Text      = siteDetail.SiteCode;
                    txtSiteCode.ReadOnly  = true;
                    txtOfficialName.Text  = (!string.IsNullOrEmpty(siteDetail.SiteShortName) ? siteDetail.SiteShortName : "");
                    txtCorporateName.Text = (!string.IsNullOrEmpty(siteDetail.SiteOfficialName) ? siteDetail.SiteOfficialName : "");
                    txtAddress1.Text      = (!string.IsNullOrEmpty(siteDetail.SiteAddressLn1) ? siteDetail.SiteAddressLn1 : "");
                    txtAddress2.Text      = (!string.IsNullOrEmpty(siteDetail.SiteAddressLn2) ? siteDetail.SiteAddressLn2 : "");
                    txtAddress3.Text      = (!string.IsNullOrEmpty(siteDetail.SiteAddressLn3) ? siteDetail.SiteAddressLn3 : "");
                    txtEmail.Text         = (!string.IsNullOrEmpty(siteDetail.EmailId) ? siteDetail.EmailId : "");
                    txtContactPerson.Text = (!string.IsNullOrEmpty(siteDetail.ContactPerson) ? siteDetail.ContactPerson : "");
                    txtContactNumber.Text = (!string.IsNullOrEmpty(siteDetail.SiteTelephone1) ? siteDetail.SiteTelephone1 : "");
                    if (siteDetail.FaxNo != "")
                    {
                        txtFaxNo.Text = siteDetail.FaxNo;
                    }
                    txtTaxNo.Text     = (!string.IsNullOrEmpty(siteDetail.LocalSalesTaxNo) ? siteDetail.LocalSalesTaxNo : "");
                    txtLicenceNo.Text = (!string.IsNullOrEmpty(siteDetail.CentralSalesTaxNo) ? siteDetail.CentralSalesTaxNo : "");
                    // fillCountries();
                    txtCountry.Text           = siteDetail.CountryCode;
                    txtCurrencyCode.Text      = siteDetail.LocalCurrancyCode;
                    txtCurrencySymol.Text     = siteCurrencyDetails.CurrencySymbol;
                    txtCountry.ReadOnly       = true;
                    txtCurrencyCode.ReadOnly  = true;
                    txtCurrencySymol.ReadOnly = true;
                    if (finYearDetails != null)
                    {
                        finYearBeginDate.SelectedText = (!string.IsNullOrEmpty(finYearDetails.ValidFromDt.ToString()) ? finYearDetails.ValidFromDt.ToString() : "");
                        finYearEndDate.SelectedText   = (!string.IsNullOrEmpty(finYearDetails.ValidToDt.ToString()) ? finYearDetails.ValidToDt.ToString() : "");
                        finYearBeginDate.ReadOnly     = true;
                        finYearEndDate.ReadOnly       = true;
                    }
                    lblInstallationDate.Visible      = true;
                    dtpInstallationDate.Visible      = true;
                    dtpInstallationDate.ReadOnly     = false;
                    dtpInstallationDate.SelectedText = (!string.IsNullOrEmpty(siteDetail.CreatedOn.ToString()) ? siteDetail.CreatedOn.ToString() : "");
                    dtpInstallationDate.ReadOnly     = true;
                    flagAddEdit = true;
                }
                objSearch.Dispose();
            }
            catch (Exception ex)
            {
                CommonFunc.ShowMessage(ex.Message, MessageType.Information);
                Logger.Log(ex.Message, Logger.LogingLevel.Error);
            }
        }