public static CustomList <StockTransactionMaster> GetAllStockTransactionMaster()
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            CustomList <StockTransactionMaster> StockTransactionMasterCollection = new CustomList <StockTransactionMaster>();
            IDataReader  reader = null;
            const String sql    = "select *from StockTransactionMaster";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    StockTransactionMaster newStockTransactionMaster = new StockTransactionMaster();
                    newStockTransactionMaster.SetData(reader);
                    StockTransactionMasterCollection.Add(newStockTransactionMaster);
                }
                return(StockTransactionMasterCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomList<StockTransactionMaster> lstStockTransactionMaster = StockTransactionMasterList;
                if (lstStockTransactionMaster.Count == 0)
                {
                    StockTransactionMaster newStockTransactionMaster = new StockTransactionMaster();
                    lstStockTransactionMaster.Add(newStockTransactionMaster);
                }
                SetDataFromControlToObj(ref lstStockTransactionMaster);
                CustomList<StockTransactionDetail> lstStockTransactionDetail = (CustomList<StockTransactionDetail>)StockTransactionDetailList;

                if (!((PageBase)this.Page).CheckUserAuthentication(lstStockTransactionMaster, lstStockTransactionDetail)) return;
                manager.SaveStockTransaction(ref lstStockTransactionMaster, ref lstStockTransactionDetail);
                txtCustomCode.Text = manager.CustomCode;
                ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg);
            }
            catch (SqlException ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
 private void PopulateStockTransaction(StockTransactionMaster objSTM)
 {
     try
     {
         txtCustomCode.Text = objSTM.CustomCode;
         txtTransactionDate.Text = objSTM.TransDate.ToShortDateString();
         if (objSTM.FromBranchID != 0)
            ddlFromBranch.SelectedValue = objSTM.FromBranchID.ToString();
         if (objSTM.FromCostCenterID != 0)
             ddlFromCostCentre.SelectedValue = objSTM.FromCostCenterID.ToString();
         if (objSTM.FromStockLocationID != 0)
             ddlFromStockLocation.SelectedValue = objSTM.FromStockLocationID.ToString();
         if (objSTM.ToBranchID != 0)
            ddlToBranch.SelectedValue = objSTM.ToBranchID.ToString();
         if (objSTM.ToCostCenterID != 0)
             ddlToCostCentre.SelectedValue = objSTM.ToCostCenterID.ToString();
         if (objSTM.ToStockLocationID != 0)
             ddlToStockLocation.SelectedValue = objSTM.ToStockLocationID.ToString();
         if (objSTM.PartyID != 0)
             ddlParty.SelectedValue = objSTM.PartyID.ToString();
         if (objSTM.CurrencyID != 0)
             ddlCurrencyID.SelectedValue = objSTM.CurrencyID.ToString();
         if (ddlFromCostCentre.SelectedValue != "")
             ddlFromCostCentre_SelectedIndexChanged(null,null);
         if (ddlToCostCentre.SelectedValue != "")
             ddlToCostCentre_SelectedIndexChanged(null, null);
         StockTransactionDetailList = new CustomList<StockTransactionDetail>();
         StockTransactionDetailList = manager.GetAllStockTransactionDetail(objSTM.StockTransID);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
 public static CustomList<StockTransactionMaster> GetAllStockTransactionMaster()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<StockTransactionMaster> StockTransactionMasterCollection = new CustomList<StockTransactionMaster>();
     IDataReader reader = null;
     const String sql = "select *from StockTransactionMaster";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             StockTransactionMaster newStockTransactionMaster = new StockTransactionMaster();
             newStockTransactionMaster.SetData(reader);
             StockTransactionMasterCollection.Add(newStockTransactionMaster);
         }
         return StockTransactionMasterCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }