Ejemplo 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);
            }
        }