Example #1
0
        private void createSupplier()
        {
            bool   Status        = false;
            string StatusDetails = null;

            ModelClass.ModelPOS.ModelSupplier mp = new ModelClass.ModelPOS.ModelSupplier()
            {
                SupplierName     = textBoxName.Text,
                SupplierPhoneNo  = textBoxPhone.Text,
                SupplierMobileNo = textBoxMobile.Text,
                SupplierAddress  = textBoxAddress.Text,
            };

            string Photo = ImageClass.GetBase64StringFromImage(Imager.Resize(pictureBoxSupplier.Image, 200, 200, true)); //Resize & Convert to String

            mp.SupplierPicture = Photo;
            MainClass.POS.CRUDSuppierCreate(mp, out Status, out StatusDetails);
            if (Status)
            {
                JIMessageBox.InformationMessage(StatusDetails);
                clearTextbox();
            }
            else
            {
                MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            gridViewSupplier.Rows.Clear();
        }
Example #2
0
        private void buttonUpdateProduct_Click(object sender, EventArgs e)
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                if (comboBocCategory.Text == "" || textBoxProductType.Text == "" || textBoxBrand.Text == "" ||
                    textBoxSize.Text == "" || textBoxColour.Text == "" || textBoxBarcode.Text == "")
                {
                    JIMessageBox.ExclamationMessage("Fill All Fields !"); return;
                }
                string Photo = ImageClass.GetBase64StringFromImage(Imager.Resize(pictureBoxProduct.Image, 200, 200, true)); //Resize & Convert to String

                MainClass.POS.usp_UpdateProduct(Convert.ToInt32(labelProductID.Text),
                                                Convert.ToInt32(comboBocCategory.SelectedValue), textBoxProductType.Text,
                                                textBoxBrand.Text, textBoxSize.Text, textBoxColour.Text, Photo, textBoxBarcode.Text,
                                                out Status, out StatusDetails);
                if (Status)
                {
                    JIMessageBox.InformationMessage("Record Updated Succesfully !");
                    displayProduct();
                    //  clearTextBox();
                }
                else
                {
                    MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void updatePurchase()
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                ModelClass.ModelPOS.ModelPurchaseNStock md = new ModelClass.ModelPOS.ModelPurchaseNStock();

                MainClass.POS.usp_UpdatePurchaseWithStock(Convert.ToInt32(textBoxQty.Text), Convert.ToInt32(textBoxActualPrice.Text), Convert.ToInt32(textBoxPurchaseUnitPrice.Text),
                                                          Convert.ToInt32(textBoxPurchaseTotalPrice.Text), textBoxBarcode.Text, dtPurchase.Value, Convert.ToInt32(cbSupplier.SelectedValue.ToString()), Convert.ToInt32(labelPurchaseID.Text), out Status, out StatusDetails);
                if (Status)
                {
                    JIMessageBox.InformationMessage(StatusDetails);
                    Clear();
                    gridViewPurchase.Rows.Clear();
                    displayPurchase();
                }
                else
                {
                    MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        private void createUser()
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                ModelClass.ModelPOS.ModelUser md = new ModelClass.ModelPOS.ModelUser();
                md.Role_ID          = int.Parse(cbRoles.SelectedValue.ToString());
                md.UserName         = tbName.Text.ToString();
                md.UserPassword     = tbPassword.Text.ToString();
                md.ContactNo        = tbphone.Text.ToString();
                md.UserDesignation  = tbDesignation.Text.ToString();
                md.CreatedByUser_ID = ModelClass._UserID;                //UserID_Static
                Bitmap img   = ImageClass.Resize((Bitmap)pictureBoxUser.Image, new Size(200, 200), System.Drawing.Imaging.ImageFormat.Jpeg);
                string Photo = ImageClass.GetBase64StringFromImage(img); //Resize & Convert to String
                md.UserPicture = Photo;
                MainClass.POS.CRUDUserCreate(md, out Status, out StatusDetails);
                if (Status)
                {
                    JIMessageBox.InformationMessage(StatusDetails);
                    Clear();
                }
                else
                {
                    MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                gridViewUser.Rows.Clear();
                displayUser();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void udmSearchFromBarcode()
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                mp.BarCode = textBoxSearchBarcode.Text.ToString();

                DataTable dt = MainClass.POS.usp_GetProduct_withoutImage(mp, out Status, out StatusDetails);
                if (Status && dt.Rows.Count > 0)
                {
                    mp.ProductID                   = int.Parse(dt.Rows[0]["ProductID"].ToString());
                    cbCategory.Text                = dt.Rows[0]["CategoryName"].ToString();
                    cbType.Text                    = dt.Rows[0]["ProductType"].ToString();
                    cbBrand.Text                   = dt.Rows[0]["ProductBrand"].ToString();
                    cbSize.Text                    = dt.Rows[0]["ProductSize"].ToString();
                    cbColor.Text                   = dt.Rows[0]["ProductColor"].ToString();
                    textBoxBarcode.Text            = dt.Rows[0]["BarCode"].ToString();
                    textBoxActualPrice.Text        = "";
                    textBoxPurchaseUnitPrice.Text  = "";
                    textBoxQty.Text                = "";
                    textBoxPurchaseTotalPrice.Text = "";
                    DataTable ddt = MainClass.POS.usp_GetProduct_withImage(mp, out Status, out StatusDetails);
                    if (Status)
                    {
                        string pImage = ddt.Rows[0]["ProductPicture"].ToString();
                        if (pImage == "ImageClass.GetImageFromBase64(Row.Cells[ProductPicture].Value.ToString())' threw an exception of type 'System.FormatException" || pImage == "" || pImage == "NoImage")
                        {
                            pictureBoxPurchase.Visible    = false;
                            labelAfterHiddenImage.Visible = true;
                            labelAfterHiddenImage.Text    = "NoImage";
                        }
                        else
                        {
                            pictureBoxPurchase.Visible    = true;
                            labelAfterHiddenImage.Visible = false;
                            pictureBoxPurchase.Image      = ImageClass.GetImageFromBase64(ddt.Rows[0]["ProductPicture"].ToString());
                        }
                        udmGetQtySumFromGridViewDown();
                    }
                    else
                    {
                        MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    JIMessageBox.InformationMessage("Invalid Barcode !");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void buttonUpdateInvoice_Click(object sender, EventArgs e)
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                if (tbSearchInvocie.Text == "")
                {
                    JIMessageBox.ExclamationMessage("Please Enter Invoice Number"); return;
                }
                if (tbSearchInvocie.Text != "")
                {
                    if (tbCustomerName.Text == "")
                    {
                        JIMessageBox.ExclamationMessage("Details Not Available !"); return;
                    }
                }


                MainClass.POS.usp_UpdateCustomer(Convert.ToInt32(labelCustomerID.Text), tbCustomerName.Text, tbContact.Text, rtbDetails.Text, out Status, out StatusDetails);
                if (Status == false)
                {
                    JIMessageBox.WarningMessage(StatusDetails);
                }
                else
                {
                    //CODE
                }

                //dtCurrentDate.Value = dtCurrentDate.Value == null ? DateTime.Now : dtCurrentDate.Value;
                //dtDueDate.Value = dtDueDate.Value == null ? DateTime.Now : dtDueDate.Value;
                MainClass.POS.UpdateSalesOrder(
                    Convert.ToInt32(labelSalesOrderID.Text), dtCurrentDate.Value, dtDueDate.Value,
                    Convert.ToInt32(tbGrandTotal.Text), Convert.ToInt32(tbAdvance.Text),
                    Convert.ToInt32(tbBalance.Text), tbSearchInvocie.Text,
                    out Status, out StatusDetails);
                if (Status == false)
                {
                    JIMessageBox.WarningMessage(StatusDetails);
                }
                else
                {
                    JIMessageBox.InformationMessage("Record Updated Successfully !");
                }
            }
            catch (Exception ex)
            {
                JIMessageBox.WarningMessage(ex.ToString());
            }
        }
Example #7
0
        private void udm_OnlyPicureAddToDatabaseBOTH(bool status, string statusDetails, int salesOrderID)
        {
            bool   Status        = false;
            string StatusDetails = null;
            int    SalesOrderID  = 0;


            if (Status)
            {
            }    //usp_InsertSalesOrder
            else
            {
                JIMessageBox.InformationMessage("ERROR Fom Database:  " + StatusDetails);
                return;
            }
        }
Example #8
0
        private void createProduct()
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                if (JIMessageBox.CheckisFieldsFill(textBoxBarcode.Text))
                {
                    ModelClass.ModelPOS.ModelProduct mp = new ModelClass.ModelPOS.ModelProduct()
                    {
                        Category_ID      = int.Parse(comboBocCategory.SelectedValue.ToString()),
                        ProductType      = textBoxProductType.Text,
                        ProductBrand     = textBoxBrand.Text,
                        ProductSize      = textBoxSize.Text,
                        ProductColor     = textBoxColour.Text,
                        CreatedByUser_ID = ModelClass._UserID, //UserID_Static
                        BarCode          = textBoxBarcode.Text
                    };

                    string Photo = ImageClass.GetBase64StringFromImage(Imager.Resize(pictureBoxProduct.Image, 200, 200, true)); //Resize & Convert to String
                    mp.ProductPicture = Photo;

                    MainClass.POS.CRUDProductCreate(mp, out Status, out StatusDetails);
                    if (Status)
                    {
                        JIMessageBox.InformationMessage(StatusDetails);
                    }
                    else
                    {
                        MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    gridViewProduct.Rows.Clear();
                }
                else
                {
                    MessageBox.Show("Please Fill All Fields", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void textBoxSearchBarcode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                try
                {
                    int  sum1  = 0;
                    int  sum2  = 0;
                    bool value = true;

                    //--Method_1
                    var _Rows = gridViewStock.Rows.Cast <DataGridViewRow>()
                                .Where(r => r.Cells["Barcode"].Value.ToString() == textBoxSearchBarcode.Text)
                                .Select(r => r.Cells["AvailableQty"].Value);


                    for (int i = 0; i < gridViewStock.Rows.Count; i++)
                    {
                        if (textBoxSearchBarcode.Text != gridViewStock.Rows[i].Cells["Barcode"].Value.ToString())
                        {
                            // JIMessageBox.ErrorMessage(textBoxSearchBarcode.Text+" is not Correct \n Please Enter Correct Barcode !");
                            // value = false;
                            // break;
                        }
                        if (textBoxSearchBarcode.Text == gridViewStock.Rows[i].Cells["Barcode"].Value.ToString())
                        {
                            sum1 += Convert.ToInt32(gridViewStock.Rows[i].Cells["AvailableQty"].Value);
                            sum2 += Convert.ToInt32(gridViewStock.Rows[i].Cells["SoldQty"].Value);
                            value = true;
                        }
                    }
                    if (value == true)
                    {
                        JIMessageBox.InformationMessage("Total Rows: " + _Rows.Count() + "\n Available Stock : " + sum1.ToString() + "\n Sold Stock : " + sum2.ToString());
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                e.Handled = true;
            }
        }
Example #10
0
        private void updateSupplier()
        {
            bool   Status        = false;
            string StatusDetails = null;

            string Photo = ImageClass.GetBase64StringFromImage(Imager.Resize(pictureBoxSupplier.Image, 200, 200, true)); //Resize & Convert to String

            MainClass.POS._UpdateSupplier(Convert.ToInt32(labelSupplierID.Text), textBoxName.Text,
                                          textBoxPhone.Text, textBoxMobile.Text, textBoxAddress.Text, Photo, out Status, out StatusDetails);
            if (Status)
            {
                JIMessageBox.InformationMessage(StatusDetails);
                clearTextbox();
            }
            else
            {
                MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            gridViewSupplier.Rows.Clear();
        }
Example #11
0
        private void tbProductAvailableQty_Leave(object sender, EventArgs e)
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                bool Condition = MainClass.POS.usp_CheckAvalibleStock(Convert.ToInt32(tbProductQty.Text), Convert.ToInt32(labelProduct_ID.Text), out Status, out StatusDetails);
                if (Condition)
                {
                    JIMessageBox.InformationMessage(StatusDetails);
                    tbProductQty.Focus();
                }
                if (Convert.ToInt32(tbProductQty.Text) <= -1)
                {
                    JIMessageBox.WarningMessage("Please Select Correct Value! ");
                    tbProductQty.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Enter Digits! : " + ex.Message);
            }
        }
        private void createPurchase()
        {
            bool   Status        = false;
            string StatusDetails = null;

            try
            {
                ModelClass.ModelPOS.ModelPurchaseNStock md = new ModelClass.ModelPOS.ModelPurchaseNStock();
                md.Product_ID         = mp.ProductID; //From_GridView_Row
                md.ActualPrice        = int.Parse(textBoxActualPrice.Text.ToString());
                md.PurchaseUnitPrice  = int.Parse(textBoxPurchaseUnitPrice.Text.ToString());
                md.PurchaseQty        = int.Parse(textBoxQty.Text.ToString());
                md.PurchaseTotalPrice = int.Parse(textBoxPurchaseTotalPrice.Text.ToString());
                //Category_ID = int.Parse(comboBocCategory.SelectedValue.ToString()),
                md.Supplier_ID      = Convert.ToInt32(cbSupplier.SelectedValue.ToString());
                md.CreatedByUser_ID = ModelClass._UserID;
                md.BarCode          = textBoxBarcode.Text;
                md.PurchaseDate     = DateTime.Parse(dtPurchase.Value.ToString());//string.Format("{0}", dtPurchase.Value.ToString("dddd, dd MMMM yyyy")));
                MainClass.POS.PurchaseCreate(md, out Status, out StatusDetails);
                if (Status)
                {
                    JIMessageBox.InformationMessage(StatusDetails);
                    Clear();
                    gridViewPurchase.Rows.Clear();
                    displayPurchase();
                }
                else
                {
                    MessageBox.Show(StatusDetails, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #13
0
        private void udmPICTURE_AddtoCart()
        {
            DataTable dt  = TableHeadingNamePicture(); //Table
            DataRow   row = dt.NewRow();               //NewRow
                                                       //Header_Names
            string RadioValue = null;

            if (radiobtnStudio.Checked)
            {
                RadioValue = radiobtnStudio.Text;
            }
            if (radiobtnMedia.Checked)
            {
                RadioValue = radiobtnMedia.Text;
            }
            if (RadioValue == null)
            {
                JIMessageBox.ExclamationMessage("Please Select Studio/Media !"); return;
            }

            row["dtPicRadioValue"] = Convert.ToString(RadioValue);
            row["dtPicCategory"]   = Convert.ToString(cbPicCategory.Text);
            row["dtPicType"]       = Convert.ToString(cbPicType.Text);
            row["dtPicBrand"]      = Convert.ToString(cbPicBrand.Text);
            if (cbPicSize.Text != null)
            {
                row["dtPicSize"] = Convert.ToString(cbPicSize.Text);
            }
            else if (cbPicSize.Text == null && tbPicSize.Text != null)
            {
                row["dtPicSize"] = Convert.ToString(tbPicSize.Text);
            }
            else if (cbPicSize.Text != null && tbPicSize.Text != null)
            {
                JIMessageBox.InformationMessage("Both Sizes Are Selected !"); return;
            }
            else
            {
                JIMessageBox.InformationMessage("Please Select Size !"); return;
            }
            row["dtPicNumber"]     = Convert.ToInt32(tbPicNumber.Text);
            row["dtPicUnitPrice"]  = Convert.ToInt32(tbPicUnitPrice.Text);
            row["dtPicQty"]        = Convert.ToInt32(tbPicQty.Text);
            row["dtPicTotalPrice"] = Convert.ToInt32(tbPicTotalPrice.Text);
            if (PicImage.Image == null)
            {
                row["dtPicImage"] = "ImageNotSelected";
            }
            else
            {
                row["dtPicImage"] = ImageClass.GetBase64StringFromImage(Imager.Resize(PicImage.Image, 200, 200, true));
            }                 //Resize & Convert to String

            dt.Rows.Add(row); //NewRow_AddInDataTable
            foreach (DataRow r in dt.Rows)
            {                 //Array ValueParams
                gridViewPICTURE.Rows.Add(r["dtPicRadioValue"].ToString(), r["dtPicNumber"].ToString(),
                                         r["dtPicCategory"].ToString(), r["dtPicType"].ToString(), r["dtPicBrand"].ToString(),
                                         r["dtPicSize"].ToString(), r["dtPicUnitPrice"].ToString(),
                                         r["dtPicQty"].ToString(), r["dtPicTotalPrice"].ToString(), r["dtPicImage"].ToString()
                                         );
            }
            dt.AcceptChanges();

            //__GrandTotal__
            udmGrandTotal();
        }
Example #14
0
        private void udm_OnlyProductAddToDatabase(bool Status, string StatusDetails, int SalesOrderID)
        {
            #region Model
            DateTime CurrentDate = DateTime.Parse(string.Format("{0}", dtCurrentDate.Value.ToString("dd-MMM-yyy")));
            DateTime DueDate     = DateTime.Parse(string.Format("{0}", dtDueDate.Value.ToString("dd-MMM-yyy")));

            mc.CategoryName    = tbCustomerName.Text;
            mc.CategoryContact = tbContact.Text;
            mc.CategoryDetails = tbDetails.Text;

            mo.SalesOrderCurrentDate = CurrentDate;
            mo.SalesOrderDueDate     = DueDate;
            mo.GrandTotal            = decimal.Parse(tbGrandTotal.Text);
            mo.Advance             = decimal.Parse(tbAdvance.Text);
            mo.Balance             = decimal.Parse(tbBalance.Text);
            mo.SalesOrderInvoiceNo = tbInvoice.Text;
            #endregion

            MainClass.POS.usp_CheckInvoiceNoIfExists(Convert.ToInt32(mo.SalesOrderInvoiceNo), out Status, out StatusDetails);
            if (Status)
            {
                //InsertCustomer - Insert SaleOrder
                MainClass.POS.usp_InsertSalesOrder(mo.SalesOrderCurrentDate, mo.SalesOrderDueDate, mo.SalesOrderInvoiceNo,
                                                   mo.GrandTotal, mo.Advance, mo.Balance, ModelClass._UserID,
                                                   mc.CategoryName, mc.CategoryContact, mc.CategoryDetails,
                                                   ModelClass._UserID,
                                                   out Status, out StatusDetails, out SalesOrderID);
                if (Status)
                {
                    for (int i = 0; i < gridViewPRODUCT.Rows.Count; i++)
                    {
                        //ProductOrder
                        MainClass.POS.usp_InsertProductOrder(SalesOrderID,
                                                             Convert.ToInt32(gridViewPRODUCT.Rows[i].Cells["Product_ID"].Value),
                                                             Convert.ToInt32(gridViewPRODUCT.Rows[i].Cells["UnitPrice"].Value),
                                                             Convert.ToInt32(gridViewPRODUCT.Rows[i].Cells["ProductTotalPrice"].Value), ModelClass._UserID,
                                                             Convert.ToInt32(gridViewPRODUCT.Rows[i].Cells["Qty"].Value.ToString()),
                                                             Convert.ToInt32(gridViewPRODUCT.Rows[i].Cells["Qty"].Value.ToString()), out Status, out StatusDetails);
                    }
                    if (Status)
                    {
                        JIMessageBox.InformationMessage("Record Saved Sccessfully!");
                        udmClearFields(); // ClearAllFields
                        gridViewPRODUCT.Rows.Clear();
                    }//ForLoop
                    else
                    {
                        JIMessageBox.InformationMessage("ERROR:  " + StatusDetails);
                        return;
                    }
                }  //usp_InsertSalesOrder
                else
                {
                    JIMessageBox.InformationMessage("ERROR Fom Database:  " + StatusDetails);
                    return;
                }
            }  //IfInvoiceExists
            else
            {
                JIMessageBox.InformationMessage(mo.SalesOrderInvoiceNo + ": Invoice Number is Already Existis");
                return;
            }
        }