示例#1
0
 public void Delete(SqlTransaction objSqlTransaction, BillItemNarrationEL _BillItemNarrationEL)
 {
     SQLHelper objSQLHelper = new SQLHelper();
     int       cpmpanyId    = objSQLHelper.ExecuteDeleteProcedure("DeleteBillItemNarration", objSqlTransaction
                                                                  , objSQLHelper.SqlParam("@BillItem_Narration_Id", _BillItemNarrationEL.BillItem_Narration_Id, SqlDbType.Int)
                                                                  );
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            BillItemNarrationEL        _BillItemNarrationEL;
            BillItemNarrationDL        _BillItemNarrationDL = new BillItemNarrationDL();
            List <BillItemNarrationEL> lstBillItemNarration = new List <BillItemNarrationEL>();

            try
            {
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    _BillItemNarrationEL = new BillItemNarrationEL();
                    _BillItemNarrationEL.Bill_Item_Id = _BillItemEL.Bill_Item_Id;
                    _BillItemNarrationEL.Narration    = dataGridView1.Rows[i].Cells["Narration"].Value.ToString();

                    if ((dataGridView1.Rows[i].Cells["BillItem_Narration_Id"].Value != null))
                    {
                        _BillItemNarrationEL.BillItem_Narration_Id = Convert.ToInt32(dataGridView1.Rows[i].Cells["BillItem_Narration_Id"].Value);;
                    }
                    else
                    {
                        _BillItemNarrationEL.BillItem_Narration_Id = 0;
                    }
                    lstBillItemNarration.Add(_BillItemNarrationEL);
                }
            }
            catch (Exception)
            {
            }


            SQLHelper      _SQLHelper  = new SQLHelper();
            SqlTransaction transaction = _SQLHelper.BeginTrans();

            try
            {
                for (int i = 0; i < lstBillItemNarration.Count; i++)
                {
                    if (lstBillItemNarration[i].BillItem_Narration_Id == 0)
                    {
                        _BillItemNarrationDL.Insert(transaction, lstBillItemNarration[i]);
                    }
                    else
                    {
                        _BillItemNarrationDL.Update(transaction, lstBillItemNarration[i]);
                    }
                }

                DeletedItemNarration.ForEach(r => _BillItemNarrationDL.Delete(transaction, r));

                transaction.Commit();
                Common.MessageSave();
                GridBind();
            }
            catch (Exception)
            {
                transaction.Rollback();
            }
        }
示例#3
0
        public void Update(SqlTransaction objSqlTransaction, BillItemNarrationEL _BillItemNarrationEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();

            objSQLHelper.ExecuteUpdateProcedure("UpdateBillItemNarration", objSqlTransaction
                                                , objSQLHelper.SqlParam("@Bill_Item_Id", _BillItemNarrationEL.Bill_Item_Id, SqlDbType.Int)
                                                , objSQLHelper.SqlParam("@Narration", _BillItemNarrationEL.Narration, SqlDbType.NVarChar)
                                                , objSQLHelper.SqlParam("@BillItem_Narration_Id", _BillItemNarrationEL.BillItem_Narration_Id, SqlDbType.Int)
                                                );
        }
示例#4
0
        public int Insert(SqlTransaction objSqlTransaction, BillItemNarrationEL _BillItemNarrationEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();

            int Id = objSQLHelper.ExecuteInsertProcedure("InsertBillItemNarration", objSqlTransaction
                                                         , objSQLHelper.SqlParam("@Bill_Item_Id", _BillItemNarrationEL.Bill_Item_Id, SqlDbType.Int)
                                                         , objSQLHelper.SqlParam("@Narration", _BillItemNarrationEL.Narration, SqlDbType.NVarChar)
                                                         );

            return(Id);
        }
        private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            int BillItemNarrationId;

            if (e.Row.Cells["BillItem_Narration_Id"].Value != null)
            {
                if (int.TryParse(e.Row.Cells["BillItem_Narration_Id"].Value.ToString(), out BillItemNarrationId))
                {
                    BillItemNarrationEL _BillItemNarrationEL = new BillItemNarrationEL();
                    _BillItemNarrationEL.BillItem_Narration_Id = BillItemNarrationId;
                    DeletedItemNarration.Add(_BillItemNarrationEL);
                }
            }
            e.Row.Visible = false;
        }
示例#6
0
        public bool Delete(BillItemNarrationEL _BillItemNarrationEL)
        {
            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                Delete(objSqlTransaction, _BillItemNarrationEL);
                objSqlTransaction.Commit();
                return(true);
            }
            catch
            {
                objSqlTransaction.Rollback();
                return(false);
            }
        }
示例#7
0
        public int Insert(BillItemNarrationEL _BillItemNarrationEL)
        {
            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                int id = Insert(objSqlTransaction, _BillItemNarrationEL);
                objSqlTransaction.Commit();
                return(id);
            }
            catch (Exception)
            {
                objSqlTransaction.Rollback();
                throw;
            }
        }
示例#8
0
        public List <BillItemNarrationEL> GetBillItemNarrationBy_BillItemId(int BillItemId)
        {
            BillItemNarrationEL        _BillItemNarrationEL;
            List <BillItemNarrationEL> lstBillItemNarration = new List <BillItemNarrationEL>();

            SQLHelper objSQLHelper = new SQLHelper();
            DataTable dt           = objSQLHelper.ExecuteSelectProcedure("SelectBillItemNarration_ByBillitemId"
                                                                         , objSQLHelper.SqlParam("@Bill_Item_Id", BillItemId, SqlDbType.Int)
                                                                         );

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    _BillItemNarrationEL = new BillItemNarrationEL();
                    _BillItemNarrationEL.Bill_Item_Id          = (int)dt.Rows[i]["Bill_Item_Id"];
                    _BillItemNarrationEL.BillItem_Narration_Id = (int)dt.Rows[i]["BillItem_Narration_Id"];
                    _BillItemNarrationEL.Narration             = dt.Rows[i]["Narration"].ToString();
                    lstBillItemNarration.Add(_BillItemNarrationEL);
                }
            }
            return(lstBillItemNarration);
        }