Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationData())
            {
                CResult   oResult = new CResult();
                CGRBO     oGRBO   = new CGRBO();
                CGRMaster oMaster = GetToBSavedData();

                if (oMaster != null)
                {
                    if (!IsUpdateMode)
                    {
                        oResult = oGRBO.Create(oMaster);
                    }
                    else
                    {
                        oResult = oGRBO.Update(oMaster, oGRFinalQtyDic);
                    }

                    if (oResult.IsSuccess)
                    {
                        MessageBox.Show("Successfully Done. ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ClearFormData();
                        GetGRNextCode();
                    }
                    else
                    {
                        MessageBox.Show(oResult.ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if ((MessageBox.Show("Do you really want to delete this Item ? ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes))
            {
                CResult oResult = new CResult();
                CGRBO   oGRBO   = new CGRBO();

                if (IsUpdateMode)
                {
                    oResult = oGRBO.Delete(txtSelectedGROID.Text.Trim());
                }

                if (oResult.IsSuccess)
                {
                    MessageBox.Show("Successfully Done. ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearFormData();
                }
                else
                {
                    MessageBox.Show(oResult.ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 3
0
        private void GetOutput()
        {
            if (ValidateFormData())
            {
                if (typeof(T) == typeof(CMTMaster))
                {
                    list = new List <T>();

                    CMaterialTransferBO oMTBO   = new CMaterialTransferBO();
                    CResult             oResult = new CResult();
                    if (txtRequisitionNo.Text.Trim() == "")
                    {
                        DateTime dtFrom = CUtils.GetDate(dtpDateFrom.Value.ToString("dd-MM-yyyy"), EDateType.FROM);
                        DateTime dtTo   = CUtils.GetDate(dtpDateTo.Value.ToString("dd-MM-yyyy"), EDateType.TO);

                        oResult = oMTBO.ReadByIDDate(dtFrom, dtTo, null);
                    }
                    else
                    {
                        oResult = oMTBO.ReadByIDDate(DateTime.Now, DateTime.Now, txtRequisitionNo.Text.Trim());
                    }

                    if (oResult.IsSuccess)
                    {
                        list = (List <T>)oResult.Data;

                        stDisplayMember = "MTMstr_OID";
                        stValueMember   = "MTMstr_OID";
                        PopulateTData();
                    }
                    else
                    {
                        MessageBox.Show(oResult.ErrMsg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        list = null;
                    }
                }
                else if (typeof(T) == typeof(CGRMaster))
                {
                    list = new List <T>();

                    CGRBO   oGRBO   = new CGRBO();
                    CResult oResult = new CResult();
                    if (txtRequisitionNo.Text.Trim() == "")
                    {
                        DateTime dtFrom = CUtils.GetDate(dtpDateFrom.Value.ToString("dd-MM-yyyy"), EDateType.FROM);
                        DateTime dtTo   = CUtils.GetDate(dtpDateTo.Value.ToString("dd-MM-yyyy"), EDateType.TO);

                        oResult = oGRBO.ReadByIDDate(dtFrom, dtTo, null, stCond);
                    }
                    else
                    {
                        oResult = oGRBO.ReadByIDDate(DateTime.Now, DateTime.Now, txtRequisitionNo.Text.Trim(), stCond);
                    }

                    if (oResult.IsSuccess)
                    {
                        list = (List <T>)oResult.Data;

                        stDisplayMember = "GRMstr_OID";
                        stValueMember   = "GRMstr_OID";
                        PopulateTData();
                    }
                    else
                    {
                        MessageBox.Show(oResult.ErrMsg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        list = null;
                    }
                }
            }
        }
Esempio n. 4
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         progressBarImport.Value = 0;
         Cursor = Cursors.WaitCursor;
         string        selectGRFromHomeMaster = "select *from t_GRMstr where GRMatr_IsImported=0";
         SqlConnection oConnectionForHomeDB   = new CConManager().GetConnectionForRemote();
         DataTable     dtHome          = new DataTable();
         SqlCommand    oCommandForHome = new SqlCommand(selectGRFromHomeMaster, oConnectionForHomeDB);
         oCommandForHome.CommandType = CommandType.Text;
         SqlDataAdapter oSqlAdapter = new SqlDataAdapter(oCommandForHome);
         oSqlAdapter.Fill(dtHome);
         List <CGRMaster> oGRMasterList = new List <CGRMaster>();
         progressBarImport.Value = 70;
         if (dtHome.Rows.Count > 0)
         {
             progressBarImport.Value = 70;
             foreach (DataRow dr in dtHome.Rows)
             {
                 CGRMaster oGRMaster = new CGRMaster();
                 oGRMaster.GRMstr_OID        = "";
                 oGRMaster.GRMstr_Branch     = currentBranch.CompBrn_Code;
                 oGRMaster.GRMstr_Code       = GetGRmstrCode();
                 oGRMaster.GRMstr_Type       = int.Parse(dr["GRMstr_Type"].ToString());
                 oGRMaster.GRMstr_Date       = DateTime.Parse(dr["GRMstr_Date"].ToString());
                 oGRMaster.GRMstr_By         = dr["GRMstr_By"].ToString();
                 oGRMaster.Remarks           = dr["GRMstr_Remarks"].ToString();
                 oGRMaster.GRMstr_RefBy      = dr["GRMstr_RefBy"].ToString();
                 oGRMaster.Creator           = dr["GRMstr_Creator"].ToString();
                 oGRMaster.CreationDate      = DateTime.Parse(dr["GRMstr_CreationDate"].ToString());
                 oGRMaster.UpdateBy          = dr["GRMstr_UpdateBy"].ToString();
                 oGRMaster.UpdateDate        = DateTime.Parse(dr["GRMstr_UpdateDate"].ToString());
                 oGRMaster.IsActive          = "Y";
                 oGRMaster.GRMstr_IsImported = 1;
                 string        selectGRForHomeDetail      = "select *from t_GRDet where GRDet_MStrOID='" + dr["GRMstr_OID"].ToString() + "'";
                 SqlConnection oConnectionForHomeDBDetail = new CConManager().GetConnectionForRemote();
                 DataTable     dtHomedetail = new DataTable();
                 SqlCommand    oCommand     = new SqlCommand(selectGRForHomeDetail, oConnectionForHomeDBDetail);
                 oCommand.CommandType = CommandType.Text;
                 SqlDataAdapter oDataAdapter = new SqlDataAdapter(oCommand);
                 oDataAdapter.Fill(dtHomedetail);
                 //List<CGRDetails> oGRDetailList = new List<CGRDetails>();
                 if (dtHomedetail.Rows.Count > 0)
                 {
                     foreach (DataRow drDetail in dtHomedetail.Rows)
                     {
                         CGRDetails oGRDetails = new CGRDetails();
                         oGRDetails.GRDet_Branch    = currentBranch.CompBrn_Code;
                         oGRDetails.GRDet_ItemOID   = drDetail["GRDet_ItemOID"].ToString();
                         oGRDetails.GRDet_QTY       = float.Parse(drDetail["GRDet_QTY"].ToString());
                         oGRDetails.GRDet_UOM       = drDetail["GRDet_UOM"].ToString();
                         oGRDetails.GRDet_BranchOID = currentBranch.CompBrn_OId;
                         oGRDetails.GRDet_LocOID    = drDetail["GRDet_LocOID"].ToString();
                         oGRDetails.GRDet_InvType   = int.Parse(drDetail["GRDet_InvType"].ToString());
                         oGRDetails.GRDet_Price     = float.Parse(drDetail["GRDet_Price"].ToString());
                         oGRDetails.GRDet_Currency  = drDetail["GRDet_Currency"].ToString();
                         oGRDetails.GRDet_Amount    = float.Parse(drDetail["GRDet_Amount"].ToString());
                         //oGRDetailList.Add(oGRDetails);
                         oGRMaster.GRMstr_DetailsList.Add(oGRDetails);
                     }
                 }
                 //oGRMaster.GRMstr_DetailsList = oGRDetailList;
                 oGRMasterList.Add(oGRMaster);
             }
             if (oGRMasterList.Count > 0)
             {
                 foreach (CGRMaster oGRMaster in oGRMasterList)
                 {
                     progressBarImport.Value = 50;
                     CResult oResult = new CResult();
                     CGRBO   oGRBO   = new CGRBO();
                     if (oGRMaster != null)
                     {
                         oResult = oGRBO.Create(oGRMaster);
                     }
                     if (oResult.IsSuccess)
                     {
                         progressBarImport.Value = 100;
                         this.Cursor             = Cursors.Default;
                         oResult = oGRBO.UpdateHomeGRTable();
                     }
                     progressBarImport.Value = 100;
                     MessageBox.Show("Goods are successfully Imported", "ETLPOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
         }
         else if (dtHome.Rows.Count <= 0)
         {
             DialogResult oDR = MessageBox.Show("You Have No Goods For Import", "ETLPOS", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
             if (oDR.ToString() == "OK")
             {
                 this.Cursor             = Cursors.Default;
                 progressBarImport.Value = 0;
             }
         }
     }
     catch
     {
         MessageBox.Show("You Have No Goods For Import", "ETLPOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 5
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
            }
        }
Esempio n. 6
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (ValidationData())
            {
                CResult   oResulto = new CResult();
                CGRBO     oGRBOo   = new CGRBO();
                CGRMaster oMastero = GetToBSavedDataExportBranch();

                if (oMastero != null)
                {
                    oResulto = oGRBOo.CreateExportInBranch(oMastero);

                    //if (oResulto.IsSuccess)
                    //{
                    //    MessageBox.Show("Successfully Done. ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //    ClearFormData();
                    //    GetGRNextCode();
                    //}
                    //else
                    //{
                    //    MessageBox.Show(oResulto.ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //}
                }
            }



            #region import

            //if (ValidationData())
            //{
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Title    = "Save an CSV File";
            saveFileDialog1.FileName = "InventoryExport.csv";
            saveFileDialog1.ShowDialog();
            string url = "";
            if (saveFileDialog1.FileName != "")
            {
                url = saveFileDialog1.FileName;
            }
            else
            {
                url = "InventoryExport.csv";
            }

            // Data2PDF();
            CResult   oResult = new CResult();
            CGRBO     oGRBO   = new CGRBO();
            CGRMaster oMaster = GetToBSavedData();

            if (oMaster != null)
            {
                if (!IsUpdateMode)
                {
                    oResult = oGRBO.ExportAndUpdate(oMaster, url);
                    //  SaveExcelFile(dt);
                }
                else
                {
                    oResult = oGRBO.Update(oMaster, oGRFinalQtyDic);
                }

                if (oResult.IsSuccess)
                {
                    MessageBox.Show("Successfully Done. ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearFormData();
                    GetGRNextCode();
                }
                else
                {
                    MessageBox.Show(oResult.ErrMsg, "Inventory empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            // }
            #endregion
        }