Пример #1
0
        private void toolStripDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (TransView.RowCount > 0)
            {
                if (TransView.FocusedRowHandle >= 0)
                {
                    if (TransView.GetRowCellValue(TransView.FocusedRowHandle, "Status").ToString() == "Register")
                    {
                        MessageBox.Show("Registration Not Delete");
                        return;
                    }

                    int Id        = Convert.ToInt32(TransView.GetRowCellValue(TransView.FocusedRowHandle, "RegTransID"));
                    int lVendorId = Convert.ToInt32(TransView.GetRowCellValue(TransView.FocusedRowHandle, "VendorId"));
                    if (Id != m_oRegister.GetMaxRegTransId(lVendorId))
                    {
                        MessageBox.Show("Do Not Delete!");
                        return;
                    }
                    DialogResult reply = MessageBox.Show("Do you want Delete?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (reply == DialogResult.Yes)
                    {
                        m_oRegister.DeleteRegTrans(Id);
                        TransView.DeleteRow(TransView.FocusedRowHandle);
                        //grdTrans.Rows.RemoveAt(grdTrans.CurrentRow.Index);
                        m_oRegUpdate.UpdateRegistration(lVendorId);
                    }
                }
            }
        }
Пример #2
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            int iTypeId = 0;

            if (optStatusType.SelectedIndex == 0)
            {
                iTypeId = 18;
            }
            else if (optStatusType.SelectedIndex == 1)
            {
                iTypeId = 19;
            }
            else if (optStatusType.SelectedIndex == 2)
            {
                iTypeId = 20;
            }

            bool bChange = false;

            if (Validation() == true)
            {
                if (m_lRegTransId == 0)
                {
                    UpdateRegNo();
                }
                else
                {
                    if (m_dOldDate != Convert.ToDateTime(dtpDate.Text))
                    {
                        if (oVType.PeriodWise == true)
                        {
                            if (BsfGlobal.CheckPeriodChange(m_dOldDate, Convert.ToDateTime(dtpDate.Text)))
                            {
                                oVType        = new BsfGlobal.VoucherType();
                                oVType        = BsfGlobal.GetVoucherNo(iTypeId, Convert.ToDateTime(dtpDate.Text), 0, 0);
                                txtRefNo.Text = oVType.VoucherNo;
                                bChange       = true;
                            }
                        }
                    }
                }


                m_oRegister.RegTransId = m_lRegTransId;
                m_oRegister.RegisterId = Convert.ToInt32(cboReg.EditValue);
                m_oRegister.RegDate    = Convert.ToDateTime(dtpDate.EditValue);
                m_oRegister.RegNo      = txtRefNo.Text;
                m_oRegister.VendorId   = Convert.ToInt32(txtVendorName.Tag);
                if (optStatusType.SelectedIndex == 0)
                {
                    m_oRegister.StatusType = "R";
                }
                else if (optStatusType.SelectedIndex == 1)
                {
                    m_oRegister.StatusType = "S";
                }
                else if (optStatusType.SelectedIndex == 2)
                {
                    m_oRegister.StatusType = "B";
                }

                m_oRegister.Supply   = chkSupply.Checked;
                m_oRegister.SFDate   = Convert.ToDateTime(dtpSFDate.EditValue);
                m_oRegister.STDate   = Convert.ToDateTime(dtpSTDate.EditValue);
                m_oRegister.SLife    = chkSLife.Checked;
                m_oRegister.SGradeId = Convert.ToInt32(txtSGradeName.Tag);

                m_oRegister.Contract = chkContract.Checked;
                m_oRegister.CFDate   = Convert.ToDateTime(dtpCFDate.EditValue);
                m_oRegister.CTDate   = Convert.ToDateTime(dtpCTDate.EditValue);
                m_oRegister.CLife    = chkCLife.Checked;
                m_oRegister.CGradeId = Convert.ToInt32(txtCGradeName.Tag);


                m_oRegister.Service  = chkService.Checked;
                m_oRegister.HFDate   = Convert.ToDateTime(dtpHFDate.EditValue);
                m_oRegister.HTDate   = Convert.ToDateTime(dtpHTDate.EditValue);
                m_oRegister.HLife    = chkHLife.Checked;
                m_oRegister.HGradeId = Convert.ToInt32(txtHGradeName.Tag);

                m_oRegister.Remarks = txtRemarks.Text;


                if (m_lRegTransId == 0)
                {
                    m_oRegister.InsertRegTrans(m_oRegister, iTypeId);
                    BsfGlobal.UpdateMaxNo(iTypeId, oVType, 0, 0);
                    if (optStatusType.SelectedIndex == 0)
                    {
                        BsfGlobal.InsertAlert("Vendor-Renewal", "" + cboReg.Text + " - Renewed Successfully", 0, BsfGlobal.g_sVendorDBName);
                    }
                    else if (optStatusType.SelectedIndex == 1)
                    {
                        BsfGlobal.InsertAlert("Vendor-BlackList", "" + cboReg.Text + " - Blocked", 0, BsfGlobal.g_sVendorDBName);
                    }
                    else if (optStatusType.SelectedIndex == 2)
                    {
                        BsfGlobal.InsertAlert("Vendor-Suspend", "" + cboReg.Text + " - Suspended", 0, BsfGlobal.g_sVendorDBName);
                    }
                }
                else
                {
                    m_oRegister.UpdateRegTrans(m_oRegister);
                    if (bChange == true)
                    {
                        BsfGlobal.UpdateMaxNo(iTypeId, oVType, 0, 0);
                    }
                }
                m_oRegUpdate.UpdateRegistration(Convert.ToInt32(txtVendorName.Tag));
                this.Close();
            }
        }
Пример #3
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            bool bChange = false;

            if (Validation() == true)
            {
                if (m_lRegisterId == 0)
                {
                    UpdateRegNo();
                }
                else
                {
                    if (m_dOldDate != Convert.ToDateTime(dtpDate.Value))
                    {
                        if (oVType.PeriodWise == true)
                        {
                            if (BsfGlobal.CheckPeriodChange(m_dOldDate, Convert.ToDateTime(dtpDate.Value)))
                            {
                                oVType        = new BsfGlobal.VoucherType();
                                oVType        = BsfGlobal.GetVoucherNo(17, Convert.ToDateTime(dtpDate.Value), 0, 0);
                                txtRegNo.Text = oVType.VoucherNo;
                                bChange       = true;
                            }
                        }
                    }
                }

                if (CheckRegNo() == true)
                {
                    m_oRegister.RegisterId = m_lRegisterId;
                    m_oRegister.RegDate    = dtpDate.Value;
                    m_oRegister.RegNo      = txtRegNo.Text;
                    m_oRegister.VendorId   = m_lVendorId;

                    m_oRegister.Supply   = chkSupply.Checked;
                    m_oRegister.SFDate   = dtpSFDate.Value;
                    m_oRegister.STDate   = dtpSTDate.Value;
                    m_oRegister.SLife    = chkSLife.Checked;
                    m_oRegister.SGradeId = Convert.ToInt32(txtSGradeName.Tag);

                    m_oRegister.Contract = chkContract.Checked;
                    m_oRegister.CFDate   = dtpCFDate.Value;
                    m_oRegister.CTDate   = dtpCTDate.Value;
                    m_oRegister.CLife    = chkCLife.Checked;
                    m_oRegister.CGradeId = Convert.ToInt32(txtCGradeName.Tag);


                    m_oRegister.Service  = chkService.Checked;
                    m_oRegister.HFDate   = dtpHFDate.Value;
                    m_oRegister.HTDate   = dtpHTDate.Value;
                    m_oRegister.HLife    = chkHLife.Checked;
                    m_oRegister.HGradeId = Convert.ToInt32(txtHGradeName.Tag);

                    m_oRegister.Remarks = txtRemarks.Text;

                    if (m_lRegisterId == 0)
                    {
                        m_oRegister.InsertRegistration(m_oRegister);
                        BsfGlobal.UpdateMaxNo(17, oVType, 0, 0);
                        BsfGlobal.InsertAlert("Vendor-Register", "" + txtVendorName.Text + " - Registered Successfully", 0, BsfGlobal.g_sVendorDBName);
                        PopulateData();
                        MessageBox.Show("Registered Successfully!", "Vendor", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        m_oRegister.UpdateRegistration(m_oRegister);
                        if (bChange == true)
                        {
                            BsfGlobal.UpdateMaxNo(17, oVType, 0, 0);
                        }
                        MessageBox.Show("Registration Updated Successfully!", "Vendor", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    m_oRegUpdate.UpdateRegistration(m_lVendorId);
                    //this.Close();
                }
            }
        }