Example #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (validatedata())
     {
         CSupplierBO occsbo  = new CSupplierBO();
         CSupplier   occs    = new CSupplier();
         CResult     oResult = new CResult();
         occs = Getformdata();
         if (this.txtOId.Text.Trim() == string.Empty)
         {
             oResult = occsbo.Create(occs);
         }
         else
         {
             if (DialogResult.OK == MessageBox.Show("Are you wanted to upadte supplier " + txtName.Text + " ?", "Confirmation!", MessageBoxButtons.OKCancel))
             {
                 oResult = occsbo.Update(occs);
             }
         }
         if (oResult.IsSuccess)
         {
             MessageBox.Show("Message saved succesfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             clearformdata();
         }
         else
         {
             MessageBox.Show("Message can not be saved", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Example #2
0
        private void LoadSupplierData()
        {
            CResult     oResult     = new CResult();
            CSupplierBO oSupplierBO = new CSupplierBO();
            CSupplier   oSupplier   = new CSupplier();

            oSupplier.Cust_CSType = ECSType.SUPPLIER;
            oResult = oSupplierBO.ReadAll(oSupplier);

            if (oResult.IsSuccess)
            {
                arrSupplierList           = oResult.Data as ArrayList;
                ddlSupplier.DataSource    = arrSupplierList;
                ddlSupplier.DisplayMember = "Cust_Name";
                ddlSupplier.ValueMember   = "Cust_OId";
            }
            else
            {
                MessageBox.Show("Loading error...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            CSupplierBO occsbo  = new CSupplierBO();
            CSupplier   occs    = new CSupplier();
            CResult     oResult = new CResult();

            //occs = Getformdata();
            if ((MessageBox.Show("Do u really want to delete. ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) == DialogResult.Yes)
            {
                oResult = occsbo.Delete(this.txtOId.Text);
            }

            if (oResult.IsSuccess)
            {
                MessageBox.Show("Deleted Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                clearformdata();
            }
            else
            {
                MessageBox.Show("Message can not be deleted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private void LoadSupplierData()
        {
            lvSupplierList.Items.Clear();
            CSupplierBO oSupplierBO = new CSupplierBO();
            CResult     oResult     = new CResult();
            CSupplier   oSupplier   = new CSupplier();

            oResult = oSupplierBO.ReadAll(oSupplier);
            if (oResult.IsSuccess)
            {
                foreach (CSupplier obj in oResult.Data as ArrayList)
                {
                    ListViewItem oItem = new ListViewItem();
                    oItem.Text = obj.Cust_OId.ToString();
                    oItem.SubItems.Add(obj.Cust_Branch).ToString();
                    oItem.SubItems.Add(obj.Cust_Id).ToString();
                    oItem.SubItems.Add(obj.Cust_Name).ToString();
                    oItem.SubItems.Add(obj.Cust_Address).ToString();
                    //  oItem.SubItems.Add(obj.Cust_DiscRate).ToString();
                    oItem.SubItems.Add(obj.Cust_Phone).ToString();
                    oItem.SubItems.Add(obj.Cust_Cell).ToString();
                    oItem.SubItems.Add(obj.Cust_ContactP).ToString();
                    oItem.SubItems.Add(obj.Cust_Fax).ToString();
                    oItem.SubItems.Add(obj.Cust_Web).ToString();
                    oItem.SubItems.Add(obj.Cust_Email).ToString();



                    lvSupplierList.Items.Add(oItem);
                    arrList.Add(obj);
                }
            }
            else
            {
                MessageBox.Show(oResult.ErrMsg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        private void ImportData()
        {
            string m_sMasterImportFileName = DateTime.Now.ToString("dd-MMM-yyyy") + "_" + currentBranch.CompBrn_Name;

            openFileDialog1.FileName         = m_sMasterImportFileName;
            openFileDialog1.InitialDirectory = @"H:\";
            openFileDialog1.Filter           = "Master File (*.mstrexp)|*.mstrexp";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                m_sMasterImportFileName = openFileDialog1.FileName;

                if (File.Exists(m_sMasterImportFileName))
                {
                    IFormatter formatter = new BinaryFormatter();
                    using (Stream stream = new FileStream(m_sMasterImportFileName, FileMode.Open, FileAccess.Read, FileShare.None))
                    {
                        byte[]       baKey        = { 51, 208, 75, 59, 223, 134, 241, 155, 170, 229, 177, 160, 246, 71, 77, 141, 66, 7, 223, 103, 97, 80, 235, 82, 94, 107, 226, 190, 76, 94, 31, 43 };
                        byte[]       baIV         = { 142, 96, 41, 14, 206, 132, 173, 19, 12, 50, 124, 121, 42, 27, 35, 9 };
                        Rijndael     rijndael     = Rijndael.Create();
                        CryptoStream cryptoStream = new CryptoStream(stream, rijndael.CreateDecryptor(baKey, baIV), CryptoStreamMode.Read);
                        //

                        {
                            CResult       oResult;
                            StringBuilder oErrBuilder = new StringBuilder();
                            try{
                                // UOM
                                ArrayList oListUOM = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Item Type
                                ArrayList oListItemType = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Item Group
                                ArrayList oListItemGroup = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Item
                                ArrayList oListItem = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Reorder Level
                                ArrayList oListReorderLevel = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Currency
                                List <CCurrency> oListCurrency = (List <CCurrency>)formatter.Deserialize(cryptoStream);

                                // Price Master
                                ArrayList oListPriceMaster = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Customer
                                ArrayList oListCustomer = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Supplier
                                ArrayList oListSupplier = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Company
                                List <CCompany> oListCompany = (List <CCompany>)formatter.Deserialize(cryptoStream);

                                // Company Branch
                                List <CCompanyBranch> oListCompanyBranch = (List <CCompanyBranch>)formatter.Deserialize(cryptoStream);

                                // Company Vs CompanyBranch
                                ArrayList oListCVB = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Inventory Location
                                ArrayList oListLocation = (ArrayList)formatter.Deserialize(cryptoStream);

                                // CompanyBranch Vs Location
                                ArrayList oListBVL = (ArrayList)formatter.Deserialize(cryptoStream);

                                // Employee
                                ArrayList oListEmployee = (ArrayList)formatter.Deserialize(cryptoStream);

                                // User
                                ArrayList oListUser = (ArrayList)formatter.Deserialize(cryptoStream);



                                //Import UOM
                                oResult = new CResult();
                                CUOMBO oUOMBO = new CUOMBO();
                                foreach (CUOM oUOM in oListUOM)
                                {
                                    oResult = oUOMBO.Import(oUOM);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("UOM : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                //Import Itemtyps
                                oResult = new CResult();
                                CItemBO oItemBO = new CItemBO();
                                foreach (CItemType oItemType in oListItemType)
                                {
                                    oResult = oItemBO.Import(oItemType);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Item Type : " + oResult.ErrMsg + "\n");
                                    }
                                }

                                //Item Group
                                oResult = new CResult();
                                foreach (CItemGroup oItemGroup in oListItemGroup)
                                {
                                    oResult = oItemBO.Import(oItemGroup);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Item Type : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import Item with images
                                oResult = new CResult();
                                foreach (CItem oItem in oListItem)
                                {
                                    oResult = oItemBO.Import(oItem);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Item : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Reorder Level
                                oResult = new CResult();
                                CReorderLevelBO oReorderLevelBO = new CReorderLevelBO();
                                foreach (CReorderLevel oReorderLevel in oListReorderLevel)
                                {
                                    oResult = oReorderLevelBO.Import(oReorderLevel);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("ReorderLevel : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // IMPORT CURRENCY
                                oResult = new CResult();
                                CCurrencyBO oCurrencyBO = new CCurrencyBO();
                                foreach (CCurrency oCurrency in oListCurrency)
                                {
                                    oResult = oCurrencyBO.Import(oCurrency);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Currency : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import Pricemaster
                                oResult = new CResult();
                                CPriceMasterBO oPriceMasterBO = new CPriceMasterBO();
                                foreach (CPriceMaster oPriceMaster in oListPriceMaster)
                                {
                                    oResult = oPriceMasterBO.Import(oPriceMaster);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Price : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import Customer
                                oResult = new CResult();
                                CCustomerBO oCustomerBO = new CCustomerBO();
                                foreach (CCustomer oCustomer in oListCustomer)
                                {
                                    oResult = oCustomerBO.Import(oCustomer);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Customer : " + oResult.ErrMsg + "/n");
                                    }
                                }


                                // Import supplier
                                oResult = new CResult();
                                CSupplierBO oSupplierBO = new CSupplierBO();
                                foreach (CSupplier oSupplier in oListSupplier)
                                {
                                    oResult = oSupplierBO.Import(oSupplier);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Supplier : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import company
                                oResult = new CResult();
                                CCompanyBO oCompanyBO = new CCompanyBO();

                                foreach (CCompany oCompany in oListCompany)
                                {
                                    oResult = oCompanyBO.Import(oCompany);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Company : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import company branch
                                oResult = new CResult();
                                CCompanyBranchBO oCompanyBranchBO = new CCompanyBranchBO();
                                foreach (CCompanyBranch oCompanyBranch in oListCompanyBranch)
                                {
                                    oResult = oCompanyBranchBO.Import(oCompanyBranch);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Company Branch: " + oResult.ErrMsg + "/n");
                                    }
                                }

                                //Company Vs CompanyBranch
                                oResult = new CResult();
                                CCVBBO oCVBBO = new CCVBBO();
                                foreach (CCVB oCVB in oListCVB)
                                {
                                    oResult = oCVBBO.Import(oCVB);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Company Vs CompanyBranch : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import Location
                                oResult = new CResult();
                                CLocBO oLocBO = new CLocBO();
                                foreach (CLocation oLocation in oListLocation)
                                {
                                    oResult = oLocBO.Import(oLocation);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Inventory location: " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import CompanyBranch Vs Location
                                oResult = new CResult();
                                foreach (CCVB oCVB in oListBVL)
                                {
                                    oResult = oCVBBO.ImportBVL(oCVB);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("CompanyBranch Vs Location : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import Employee
                                oResult = new CResult();
                                CEmployeeBO oEmployeeBO = new CEmployeeBO();
                                foreach (CEmployee oEmployee in oListEmployee)
                                {
                                    oResult = oEmployeeBO.Import(oEmployee);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("Employee : " + oResult.ErrMsg + "/n");
                                    }
                                }

                                // Import User
                                oResult = new CResult();
                                CUserBO oUserBO = new CUserBO();
                                foreach (CUser oUser in oListUser)
                                {
                                    oResult = oUserBO.Import(oUser);
                                    if (!oResult.IsSuccess)
                                    {
                                        oErrBuilder.Append("User : "******"/n");
                                    }
                                }

                                if (oErrBuilder.Length != 0)
                                {
                                    MessageBox.Show(oErrBuilder.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                                else
                                {
                                    MessageBox.Show("Successfully Imported. ", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }

                            //
                            cryptoStream.Close();
                        }
                    }
                }
            }
        }
Example #6
0
        private void ExportData()
        {
            string m_sMasterExportFileName = DateTime.Now.ToString("dd-MMM-yyyy") + "_" + currentBranch.CompBrn_Name;

            saveFileDialog1.FileName         = m_sMasterExportFileName;
            saveFileDialog1.InitialDirectory = @"H:\";
            saveFileDialog1.Filter           = "Master File (*.mstrexp)|*.mstrexp";

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                m_sMasterExportFileName = saveFileDialog1.FileName;

                IFormatter formatter = new BinaryFormatter();
                using (Stream stream = new FileStream(m_sMasterExportFileName, FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    byte[]       baKey        = { 51, 208, 75, 59, 223, 134, 241, 155, 170, 229, 177, 160, 246, 71, 77, 141, 66, 7, 223, 103, 97, 80, 235, 82, 94, 107, 226, 190, 76, 94, 31, 43 };
                    byte[]       baIV         = { 142, 96, 41, 14, 206, 132, 173, 19, 12, 50, 124, 121, 42, 27, 35, 9 };
                    Rijndael     rijndael     = Rijndael.Create();
                    CryptoStream cryptoStream = new CryptoStream(stream, rijndael.CreateEncryptor(baKey, baIV), CryptoStreamMode.Write);
                    //

                    {
                        CResult oResult;

                        // UOM
                        oResult = new CResult();
                        CUOMBO oUOMBO = new CUOMBO();
                        oResult = oUOMBO.ReadAll();
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListUOM = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListUOM);
                        }
                        // Item Type
                        oResult = new CResult();
                        CItemBO oItemBO = new CItemBO();
                        oResult = oItemBO.ReadAll(new CItemType());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListItemType = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListItemType);
                        }
                        // Item Group
                        oResult = new CResult();
                        oItemBO = new CItemBO();
                        oResult = oItemBO.ReadAll(new CItemGroup());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListItemGroup = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListItemGroup);
                        }
                        // Item
                        oResult = new CResult();
                        oItemBO = new CItemBO();
                        oResult = oItemBO.ReadAll();
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListItem = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListItem);
                        }
                        // Reorder Level
                        oResult = new CResult();
                        CReorderLevelBO oReorderLevelBO = new CReorderLevelBO();
                        oResult = oReorderLevelBO.ReadAllReorderLevelData(new CReorderLevel());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListReorderLevel = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListReorderLevel);
                        }
                        // Currency
                        oResult = new CResult();
                        CCurrencyBO oCurrencyBO = new CCurrencyBO();
                        oResult = oCurrencyBO.ReadAll();
                        if (oResult.IsSuccess)
                        {
                            List <CCurrency> oListCurrency = (List <CCurrency>)oResult.Data;
                            formatter.Serialize(cryptoStream, oListCurrency);
                        }
                        // Price Master
                        oResult = new CResult();
                        CPriceMasterBO oPriceMasterBO = new CPriceMasterBO();
                        oResult = oPriceMasterBO.ReadAll();
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListPriceMaster = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListPriceMaster);
                        }
                        // Customer
                        oResult = new CResult();
                        CCustomerBO oCustomerBO = new CCustomerBO();
                        oResult = oCustomerBO.ReadAll(new CCustomer());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListCustomer = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListCustomer);
                        }
                        // Supplier
                        oResult = new CResult();
                        CSupplierBO oSupplierBO = new CSupplierBO();
                        oResult = oSupplierBO.ReadAll(new CSupplier());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListSupplier = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListSupplier);
                        }
                        // Company
                        oResult = new CResult();
                        CCompanyBO oCompanyBO = new CCompanyBO();
                        oResult = oCompanyBO.ReadAll();
                        if (oResult.IsSuccess)
                        {
                            List <CCompany> oListCompany = (List <CCompany>)oResult.Data;
                            formatter.Serialize(cryptoStream, oListCompany);
                        }
                        // Company Branch
                        oResult = new CResult();
                        CCompanyBranchBO oCompanyBranchBO = new CCompanyBranchBO();
                        oResult = oCompanyBranchBO.ReadAll();
                        if (oResult.IsSuccess)
                        {
                            List <CCompanyBranch> oListCompanyBranch = (List <CCompanyBranch>)oResult.Data;
                            formatter.Serialize(cryptoStream, oListCompanyBranch);
                        }
                        // Company Vs CompanyBranch
                        oResult = new CResult();
                        CCVBBO oCVBBO = new CCVBBO();
                        oResult = oCVBBO.ReadAllCVB(new CCVB());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListCVB = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListCVB);
                        }
                        // Inventory Location
                        oResult = new CResult();
                        CLocBO oLocBO = new CLocBO();
                        oResult = oLocBO.ReadAll();
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListLocation = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListLocation);
                        }
                        // CompanyBranch Vs Location
                        oResult = new CResult();
                        oCVBBO  = new CCVBBO();
                        oResult = oCVBBO.ReadAllBVL(new CCVB());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListCVB = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListCVB);
                        }
                        // Employee
                        oResult = new CResult();
                        CEmployeeBO oEmployeeBO = new CEmployeeBO();
                        oResult = oEmployeeBO.ReadAllEmployee(new CEmployee());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListEmployee = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListEmployee);
                        }
                        // User
                        oResult = new CResult();
                        CUserBO oUserBO = new CUserBO();
                        oResult = oUserBO.ReadAllUserData(new CUser());
                        if (oResult.IsSuccess)
                        {
                            ArrayList oListUser = (ArrayList)oResult.Data;
                            formatter.Serialize(cryptoStream, oListUser);
                        }
                    }
                    //
                    cryptoStream.Close();
                }
            }
            this.Close();
        }