Ejemplo n.º 1
0
 public frmDQE()
 {
     InitializeComponent();
     oDQEReg = new DQEMasterBO();
     oDQE = new DQEBL();
 }
Ejemplo n.º 2
0
        private void UpdateData()
        {
            dtpDPEDate.DoValidate();
            dtpFrmDate.DoValidate();
            dtpToDate.DoValidate();

            if (gridView1.RowCount == 0)
            {
                MessageBox.Show("There is No Item", "WPM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (BsfGlobal.FindPermission("General-Allow-Future-Date-Entries") == false)
            {
                BsfGlobal.Get_ServerDate();
                if (Convert.ToDateTime(Convert.ToDateTime(dtpDPEDate.EditValue).ToString("dd MMM yyyy")) > BsfGlobal.g_dServerDate)
                {
                    MessageBox.Show("DQE Date is Greater than Current Date. Cannot Proceed...");
                    dtpDPEDate.Focus();
                    return;
                }
            }

            if (BsfGlobal.FindPermission("General-Allow-Back-Date-Entries") == false)
            {
                Nullable<DateTime> dNulldate = BsfGlobal.GetFreezeBackDate(96);
                if (dNulldate != null)
                {
                    if (Convert.ToDateTime(Convert.ToDateTime(dtpDPEDate.EditValue).ToString("dd MMM yyyy")) < dNulldate)
                    {
                        string stg = "Do Not Allow Back Date Entry Before" + dNulldate.ToString();
                        MessageBox.Show(stg, "WPM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
            }

            oDQEReg = new DQEMasterBO();
            oDQEReg.EDate = Convert.ToDateTime(dtpDPEDate.EditValue);
            oDQEReg.FDate = Convert.ToDateTime(dtpFrmDate.EditValue);
            oDQEReg.TDate = Convert.ToDateTime(dtpToDate.EditValue);
            oDQEReg.CCVNo = txtCCDPENo.Text;
            oDQEReg.CompVNo = txtCompBVNo.Text;
            oDQEReg.VNo = txtLVNo.Text;
            oDQEReg.CostCentreId = m_iCCId;
            oDQEReg.UserId = Convert.ToInt32(CommFun.IsNullCheck(cboUser.EditValue,CommFun.datatypes.vartypenumeric));
            oDQEReg.Narration = CommFun.Insert_SingleQuot(CommFun.IsNullCheck(txtNote.EditValue, CommFun.datatypes.vartypestring).ToString());
            oDQEReg.Ready = Convert.ToBoolean(barEditItem1.EditValue);

            bool bUpdate = false;
            string sRefNo = "";
            if (m_sMode == "A")
            {
                int iRegId = 0;
                bUpdate = oDQE.InsertDQE(oDQEReg, m_tIOWTrans, oDQEWBSTrans, ref iRegId, ref sRefNo);

                if (bUpdate == true)
                {
                    if (Convert.ToBoolean(barEditItem1.EditValue) == true)
                    {
                        BsfGlobal.Get_ServerDate();
                        BsfGlobal.InsertLog(BsfGlobal.g_dServerDateTime, "DQE-Entry-Create", "N", "DQE-Entry", iRegId, m_iCCId, m_iCompanyId, BsfGlobal.g_sWPMDBName, sRefNo, BsfGlobal.g_lUserId);
                    }
                    ClearEntries();
                    cboCostcentre.Focus();
                }
            }
            else
            {
                if (m_dEntryDate != Convert.ToDateTime(dtpDPEDate.EditValue))
                {
                    if (oVType.PeriodWise == true)
                    {

                        if (BsfGlobal.CheckPeriodChange(oDQEReg.EDate, Convert.ToDateTime(dtpDPEDate.EditValue)) == true)
                        {
                            oVType = BsfGlobal.GetVoucherNo(96, Convert.ToDateTime(dtpDPEDate.EditValue), 0, 0);
                            if (oVCCType.GenType == true)
                            {
                                txtLVNo.Text = oVType.VoucherNo;
                                oDQEReg.VNo = oVType.VoucherNo;
                            }
                            oVCCType = BsfGlobal.GetVoucherNo(96, Convert.ToDateTime(dtpDPEDate.EditValue), 0, oDQEReg.CostCentreId);
                            if (oVCCType.GenType == true)
                            {
                                txtCCDPENo.Text = oVCCType.VoucherNo;
                                oDQEReg.CCVNo = oVCCType.VoucherNo;
                            }

                            oVCompanyType = BsfGlobal.GetVoucherNo(96, Convert.ToDateTime(dtpDPEDate.EditValue), oDQEReg.CompanyId, 0);
                            if (oVCompanyType.GenType == true)
                            {
                                txtCompBVNo.Text = oVCompanyType.VoucherNo;
                                oDQEReg.CompVNo = oVCompanyType.VoucherNo;
                            }

                            BsfGlobal.UpdateMaxNo(96, oVType, 0, 0);
                            BsfGlobal.UpdateMaxNo(96, oVCCType, 0, oDQEReg.CostCentreId);
                            BsfGlobal.UpdateMaxNo(96, oVCompanyType, oDQEReg.CompanyId, 0);
                        }
                    }
                }

                bUpdate = oDQE.UpdateDQE(m_iRegId, oDQEReg, m_tIOWTrans, oDQEWBSTrans);
                if (bUpdate == true)
                {
                    if (m_sVoucherType == "GE" || m_sVoucherType == "  ")
                    { sRefNo = oDQEReg.VNo; }
                    else if (m_sVoucherType == "CC")
                    { sRefNo = oDQEReg.CCVNo; }
                    else if (m_sVoucherType == "CO")
                    { sRefNo = oDQEReg.CompVNo; }

                    if (Convert.ToBoolean(barEditItem1.EditValue) == true)
                    {
                        BsfGlobal.Get_ServerDate();
                        if (barEditItem1.Enabled == true)
                        {
                            BsfGlobal.InsertLog(BsfGlobal.g_dServerDateTime, "DQE-Entry-Create", "N", "DQE-Entry", m_iRegId, m_iCCId, m_iCompanyId, BsfGlobal.g_sWPMDBName, sRefNo, BsfGlobal.g_lUserId);
                        }
                        else
                        {
                            BsfGlobal.InsertLog(BsfGlobal.g_dServerDateTime, "DQE-Entry-Modify", "E", "DQE-Entry", m_iRegId, m_iCCId, m_iCompanyId, BsfGlobal.g_sWPMDBName, sRefNo, BsfGlobal.g_lUserId);
                        }
                    }

                    this.Close();
                }
            }
        }
Ejemplo n.º 3
0
 private void ClearEntries()
 {
     m_tIOWTrans.Rows.Clear();
     oDQEReg = new DQEMasterBO();
     oDQEMsrmnt = new List<DQEMeasurementBOUpdate>();
     oDQEWBSTrans = new List<DQEWBSTrans>();
     txtNote.Text = "";
     cboCostcentre.Enabled = true;
     GetVoucherNo();
 }