Example #1
0
        private void btnExportItems_Click(object sender, EventArgs e)
        {
            if (txtDelvNO.Text.Trim() != "")
            {
                List <CMTMaster> olistMT   = new List <CMTMaster>();
                CMTMaster        oMTMaster = new CMTMaster();

                CMaterialTransferBO oMTBO   = new CMaterialTransferBO();
                CResult             oResult = new CResult();
                if (txtDelvNO.Text.Trim() != "")
                {
                    oResult = oMTBO.ReadByIDDate(DateTime.Now.Date, DateTime.Now.Date, txtDelvNO.Text.Trim());
                }

                if (oResult.IsSuccess)
                {
                    olistMT = (List <CMTMaster>)oResult.Data;

                    oMTMaster = (CMTMaster)olistMT[0];
                }
                else
                {
                    MessageBox.Show(oResult.ErrMsg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    oMTMaster = null;
                }


                string m_sMTExportFileName = txtDelvNO.Text.Trim();

                saveFileDialog1.FileName         = m_sMTExportFileName;
                saveFileDialog1.InitialDirectory = @"H:\";
                saveFileDialog1.Filter           = "Delivery File (*.dlvexp)|*.dlvexp";

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

                    if (oMTMaster != null)
                    {
                        IFormatter formatter = new BinaryFormatter();
                        using (Stream stream = new FileStream(m_sMTExportFileName, 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);

                            //
                            formatter.Serialize(cryptoStream, oMTMaster);
                            //

                            cryptoStream.Close();
                        }
                    }
                }
            }
        }
Example #2
0
        private void GenerateReport()
        {
            CMaterialTransferBO oMaterialTransferBO = new CMaterialTransferBO();
            CResult             oResult             = new CResult();

            oResult = oMaterialTransferBO.ReadAllMTForExportRpt(txtDelvNO.Text.Trim());

            if (oResult.IsSuccess)
            {
                DataSet   dsOUT = (DataSet)oResult.Data;
                DataTable dtOUT = dsOUT.Tables[0];

                if (dtOUT.Rows.Count > 0)
                {
                    POS       posdateset = new POS();
                    DataTable dtMTIN     = posdateset.MT;

                    foreach (DataRow drOUT in dtOUT.Rows)
                    {
                        DataRow drIN = dtMTIN.NewRow();

                        drIN["ItemName"]    = drOUT["ItemName"];
                        drIN["Qty"]         = drOUT["Qty"];
                        drIN["UOMCode"]     = drOUT["UOMCode"];
                        drIN["SBranchName"] = drOUT["SBranchName"];
                        drIN["DBranchName"] = drOUT["DBranchName"];


                        dtMTIN.Rows.Add(drIN);
                    }

                    rptMT orpt = new rptMT();
                    orpt.SetDataSource(posdateset);
                    orpt.SetParameterValue(0, currentBranch.CompBrn_Name.Trim());
                    orpt.SetParameterValue(1, txtDelvNO.Text.Trim());
                    orpt.SetParameterValue(2, currentUser.User_UserName);

                    crystalReportViewer1.ReportSource = orpt;
                    crystalReportViewer1.Show();
                }
                else
                {
                    MessageBox.Show("NO data available to this delivery no", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(oResult.ErrMsg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        private void LoadRelationData()
        {
            CResult             oResult = new CResult();
            CCVB                oCVB    = new CCVB();
            CMaterialTransferBO oMTBO   = new CMaterialTransferBO();

            oResult = oMTBO.ReadAll(oCVB);

            if (oResult.IsSuccess)
            {
                oCVBList = oResult.Data as List <CCVB>;
            }
            else
            {
                MessageBox.Show("Loading error...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationData())
            {
                CResult             oResult             = new CResult();
                CMaterialTransferBO oMaterialTransferBO = new CMaterialTransferBO();
                CMTMaster           oMaster             = GetToBSavedData();

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

                    if (oResult.IsSuccess)
                    {
                        if (currentBranch.CompBrn_IsHeadoffice == "Y")
                        {
                            if (MessageBox.Show("Successfully Done. Do u want to Export these data? ", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                            {
                                frmMTExpItems objMTExpItems = new frmMTExpItems(txtDeliverOrder.Text.Trim());
                                objMTExpItems.Show();
                            }
                        }
                        ClearFormData();
                        GetDeliverID();
                    }
                    else
                    {
                        MessageBox.Show(oResult.ErrMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #5
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();
                CMaterialTransferBO oMaterialTransferBO = new CMaterialTransferBO();

                if (IsUpdateMode)
                {
                    oResult = oMaterialTransferBO.Delete(txtSelectedMTOID.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);
                }
            }
        }
Example #6
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;
                    }
                }
            }
        }