Beispiel #1
0
        public static Entity.PurchaseOrder.PurchaseOrderEntry GetAllById(int PurchaseBillId)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.CommandType = CommandType.StoredProcedure;
                oDm.Add("@PurchaseBillId", SqlDbType.Int, PurchaseBillId);
                SqlDataReader dr = oDm.ExecuteReader("usp_PurchaseBillEntry_GetAllById");
                Entity.PurchaseOrder.PurchaseOrderEntry Entry = new Entity.PurchaseOrder.PurchaseOrderEntry();

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Entry.PurchaseBillId = PurchaseBillId;
                        Entry.BillNo         = (dr[1] == DBNull.Value) ? "" : dr[1].ToString();

                        Entry.BillDate            = (dr[2] == DBNull.Value) ? DateTime.MinValue : DateTime.Parse(dr[2].ToString());
                        Entry.BillAmount          = (dr[3] == DBNull.Value) ? 0 : decimal.Parse(dr[3].ToString());
                        Entry.SupplierLedgerID_FK = (dr[4] == DBNull.Value) ? 0 : int.Parse(dr[4].ToString());
                        Entry.PurchaseLedgerID_FK = (dr[5] == DBNull.Value) ? 0 : int.Parse(dr[5].ToString());
                        Entry.Narration           = (dr[6] == DBNull.Value) ? "" : (dr[6].ToString());
                    }
                }
                return(Entry);
            }
        }
Beispiel #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strValues = txtBillDate.Text;

            strValues += chr.ToString() + "";
            DataSet ds_fn = gf.ExecuteSelectSP("spSelect_GetFnYear", strValues);

            if (ds_fn.Tables[0].Rows[0]["FinYearID"].ToString() == Session["FinYrID"].ToString().Trim())
            {
                if (Validate())
                {
                    BusinessLayer.PurchaseOrder.PurchaseOrderEntry ObjPO = new BusinessLayer.PurchaseOrder.PurchaseOrderEntry();
                    Entity.PurchaseOrder.PurchaseOrderEntry        PO    = new Entity.PurchaseOrder.PurchaseOrderEntry();
                    PO.PurchaseBillId = PurchaseBillId;
                    PO.BillNo         = txtBillNo.Text.Trim();

                    PO.BillDate = Convert.ToDateTime(txtBillDate.Text.Trim());

                    PO.BillAmount          = decimal.Parse(txtBillAmt.Text.Trim());
                    PO.SupplierLedgerID_FK = int.Parse(ddlSupplier.SelectedValue);
                    PO.PurchaseLedgerID_FK = int.Parse(ddlPurchaseLedger.SelectedValue.Trim());
                    PO.CompanyID_FK        = Convert.ToInt32(Session["CompanyId"].ToString());
                    PO.BranchID_FK         = Convert.ToInt32(Session["BranchId"].ToString());
                    PO.FinYearID_FK        = Convert.ToInt32(Session["FinYrID"].ToString());
                    PO.DataFlow            = Convert.ToInt32(Session["DataFlow"].ToString());
                    PO.Narration           = txtNarration.Text.Trim();
                    PO.CreatedBy           = int.Parse(HttpContext.Current.User.Identity.Name);
                    PO.ModifiedBy          = int.Parse(HttpContext.Current.User.Identity.Name);

                    int RowsAffected = ObjPO.Save(PO);
                    if (RowsAffected != -1)
                    {
                        Message.IsSuccess = true;
                        Message.Text      = "Data Saved Successfully";
                        ClearControls();
                        LoadPOList();
                    }
                    else
                    {
                        Message.IsSuccess = false;
                        Message.Text      = "Can Not Save. Duplicate Bill No is Not Allowed. Please Check";
                    }
                }
            }
            else
            {
                Message.IsSuccess = false;
                Message.Text      = "Please select a Date Between " + Session["SesFromDate"].ToString() + " & " + Session["SesToDate"].ToString() + "";
            }
            Message.Show = true;
        }
Beispiel #3
0
        protected void LoadPODetails()
        {
            BusinessLayer.PurchaseOrder.PurchaseOrderEntry ObjPO = new BusinessLayer.PurchaseOrder.PurchaseOrderEntry();
            Entity.PurchaseOrder.PurchaseOrderEntry        PO    = new Entity.PurchaseOrder.PurchaseOrderEntry();
            PO = ObjPO.GetAllById(PurchaseBillId);
            if (PO != null)
            {
                txtBillNo.Text                  = PO.BillNo;
                txtBillDate.Text                = PO.BillDate.ToString("dd MMM yyyy");
                txtBillAmt.Text                 = PO.BillAmount.ToString("#0.00");
                ddlSupplier.SelectedValue       = PO.SupplierLedgerID_FK.ToString();
                ddlPurchaseLedger.SelectedValue = PO.PurchaseLedgerID_FK.ToString();
                txtNarration.Text               = PO.Narration.ToString();

                btnSave.Text = "Update";
                Message.Show = false;
            }
        }
Beispiel #4
0
        public static int Save(Entity.PurchaseOrder.PurchaseOrderEntry Entry)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@PurchaseBillId", SqlDbType.Int, Entry.PurchaseBillId);
                oDm.Add("@BillNo", SqlDbType.VarChar, 50, Entry.BillNo);
                oDm.Add("@BillDate", SqlDbType.DateTime, Entry.BillDate);
                oDm.Add("@BillAmount", SqlDbType.Decimal, Entry.BillAmount);
                oDm.Add("@SupplierLedgerID_FK", SqlDbType.Int, Entry.SupplierLedgerID_FK);
                oDm.Add("@PurchaseLedgerID_FK", SqlDbType.Int, Entry.PurchaseLedgerID_FK);

                oDm.Add("@CompanyID_FK", SqlDbType.Int, Entry.CompanyID_FK);
                oDm.Add("@BranchID_FK", SqlDbType.Int, Entry.BranchID_FK);
                oDm.Add("@FinYearID_FK", SqlDbType.Int, Entry.FinYearID_FK);
                oDm.Add("@Narration", SqlDbType.VarChar, Entry.Narration);
                oDm.Add("@DataFlow", SqlDbType.Int, Entry.DataFlow);
                oDm.Add("@CreatedBy", SqlDbType.Int, Entry.CreatedBy);
                oDm.Add("@ModifiedBy", SqlDbType.Int, Entry.ModifiedBy);
                oDm.CommandType = CommandType.StoredProcedure;

                return(oDm.ExecuteNonQuery("usp_PurchaseBillEntry_Save"));
            }
        }
 public int Save(Entity.PurchaseOrder.PurchaseOrderEntry Entry)
 {
     return(DataAccess.PurchaseOrder.PurchaseOrderEntry.Save(Entry));
 }