Beispiel #1
0
        private void txtCustomerPaid_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!(e.KeyChar >= 48 && e.KeyChar <= 57) && !(e.KeyChar == 8))
            {
                e.Handled = true;
            }
            if (e.KeyChar == 13)
            {
                DialogResult res = MessageBox.Show("Confirm Salse", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res.ToString() == "Yes")
                {
                    if (defaultUserMode)
                    {
                        if (ValidateToBSaveData())
                        {
                            CResult   oResult   = new CResult();
                            CSOBO     oSOBO     = new CSOBO();
                            CSOMaster oSOMaster = GetToSOFormData();

                            if (oSOMaster.SOMstr_DetailsList.Count > 0)
                            {
                                oResult = oSOBO.Create(oSOMaster);

                                if (oResult.IsSuccess)
                                {
                                    //MessageBox.Show("Successfully Done. ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    string SOMstID = (string)oResult.Data;
                                    this.GenerateInvoiceReport(SOMstID);
                                    this.ClearAll();
                                    this.LoadItemList();
                                }
                                else
                                {
                                    MessageBox.Show(oResult.ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void btnSaveAndPrint_Click(object sender, EventArgs e)
        {
            if (defaultUserMode)
            {
                if (ValidateToBSaveData())
                {
                    CResult   oResult   = new CResult();
                    CSOBO     oSOBO     = new CSOBO();
                    CSOMaster oSOMaster = GetToSOFormData();

                    if (oSOMaster.SOMstr_DetailsList.Count > 0)
                    {
                        oResult = oSOBO.Create(oSOMaster);

                        if (oResult.IsSuccess)
                        {
                            //MessageBox.Show("Successfully Done. ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            string SOMstID = (string)oResult.Data;
                            this.GenerateInvoiceReport(SOMstID);
                            this.ClearAll();
                            txtbarcode.Select();
                            this.LoadItemList();
                        }
                        else
                        {
                            MessageBox.Show(oResult.ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            else
            {
                // Advance Start

                string m_sAdvanceConfigFileName = "AdvanceConfigAndLogFile.config";

                if (ValidateToBSaveData())
                {
                    CResult   oResult   = new CResult();
                    CSOBO     oSOBO     = new CSOBO();
                    CSOMaster oSOMaster = GetToSOFormData();

                    if (oSOMaster.SOMstr_DetailsList.Count > 0)
                    {
                        List <CSOMaster> oListSOMaster = new List <CSOMaster>();

                        System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                        if (File.Exists(m_sAdvanceConfigFileName))
                        {
                            using (Stream stream = new FileStream(m_sAdvanceConfigFileName, 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);
                                //
                                oListSOMaster = (List <CSOMaster>)formatter.Deserialize(cryptoStream);

                                //
                                cryptoStream.Close();
                            }
                        }
                        oListSOMaster.Add(oSOMaster);
                        formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                        using (Stream stream = new FileStream(m_sAdvanceConfigFileName, FileMode.OpenOrCreate, 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);
                            //
                            formatter.Serialize(cryptoStream, oListSOMaster);

                            //
                            cryptoStream.Close();
                        }
                        {
                            CResult oResult2 = new CResult();
                            CGRBO   oGRBO    = new CGRBO();
                            oResult2 = oGRBO.ReduceByItemOID(oSOMaster.SOMstr_DetailsList);
                        }

                        //this.LoadItemList();
                        this.GenerateInvoiceReport(oSOMaster);
                        this.ClearAll();
                        txtbarcode.Select();
                    }
                    //
                }
                // Advance End
            }
        }