예제 #1
0
        private void FillPurchaseList()
        {
            lvPurchasetList.Items.Clear();
            CPurchaseBO      oPurchaseBO   = new CPurchaseBO();
            CResult          oresult       = new CResult();
            List <CPurchase> oPurchaseList = new List <CPurchase>();

            oresult = oPurchaseBO.ReadAllByFromToDate(dtpFromDate.Value.Date, dtpToDate.Value.Date);
            if (oresult.IsSuccess)
            {
                if (oresult.Data != null)
                {
                    int i = 0;
                    foreach (CPurchase oPurchase in oresult.Data as ArrayList)
                    {
                        ListViewItem lvi = new ListViewItem();
                        lvi.Text = (i + 1).ToString("00");
                        lvi.SubItems.Add(oPurchase.Purchase_PartyName);
                        lvi.SubItems.Add(oPurchase.Purchase_GroupName);
                        lvi.SubItems.Add(oPurchase.Purchase_Quantity.ToString());
                        lvi.SubItems.Add(oPurchase.Purchase_Date.ToShortDateString());
                        lvi.SubItems.Add(oPurchase.Purchase_Amount.ToString());
                        lvi.Tag = oPurchase;
                        lvPurchasetList.Items.Add(lvi);
                        i++;
                    }
                }
            }
            else
            {
                MessageBox.Show(oresult.ErrMsg);
            }
        }
예제 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CPurchase   oPayment = lvPurchasetList.FocusedItem.Tag as CPurchase;
            CPurchaseBO oPartyBO = new CPurchaseBO();
            CResult     oResult  = new CResult();

            if (ValidateData())
            {
                oResult = oPartyBO.Update(GetFormData(oPayment));
                if (oResult.IsSuccess)
                {
                    MessageBox.Show("Update successfully");
                    FillPurchaseList();
                }
                else
                {
                    MessageBox.Show("Not Updated" + oResult.ErrMsg + "");
                }
                ClearControl(groupBox1);
                FillPurchaseList();
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CPurchase   oPurchase   = new CPurchase();
            CPurchaseBO oPurchaseBO = new CPurchaseBO();
            CResult     oResult     = new CResult();

            if (ValidateData())
            {
                oResult = oPurchaseBO.Create(GetFormData(oPurchase));
                if (oResult.IsSuccess)
                {
                    MessageBox.Show("          Saved successfully              ");

                    FillPurchaseList();
                }
                else
                {
                    MessageBox.Show("         Not Saved         " + oResult.ErrMsg + "");
                }
                ClearControl(groupBox1);
            }
        }
예제 #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (txtOId.Text != string.Empty)
            {
                if ((MessageBox.Show("Do u really want to delete this item. ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) == DialogResult.Yes)
                {
                    CPurchase   oPurchase   = GetFormData();
                    CPurchaseBO oPurchaseBO = new CPurchaseBO();
                    CResult     oresult     = new CResult();
                    oresult = oPurchaseBO.Delete(oPurchase);
                    if (oresult.IsSuccess == true)
                    {
                        //if (oresult.Data.ToString() == "0")
                        //{

                        //    MessageBox.Show("Deletion Not Possible", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //    FillPaymentList();
                        //    ClearControl(groupBox1);

                        //}

                        //else
                        //{

                        MessageBox.Show("Deleted Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        FillPurchaseList();
                        ClearControl(groupBox1);
                        //}
                    }

                    else
                    {
                        MessageBox.Show("Error" + oresult.ErrMsg + "");
                    }
                }
            }
        }