Exemple #1
0
        public PharmaBusinessObjects.Transaction.PurchaseSaleBookHeader GetPurchaseSaleBookHeaderForModify(long purchaseSaleBookHeaderID)
        {
            try
            {
                PharmaBusinessObjects.Transaction.PurchaseSaleBookHeader header = new PharmaBusinessObjects.Transaction.PurchaseSaleBookHeader();

                string ConnString = ConfigurationManager.ConnectionStrings["PharmaDBConn"].ConnectionString;

                using (SqlConnection connection = new SqlConnection(ConnString))
                {
                    SqlCommand cmd = new SqlCommand("GetPurchaseSaleBookHeaderForModify", connection);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    cmd.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@PurchaseSaleBookHeaderID", Value = purchaseSaleBookHeaderID
                    });

                    SqlDataAdapter sda = new SqlDataAdapter(cmd);
                    DataTable      dt  = new DataTable();

                    sda.Fill(dt);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        header.PurchaseSaleBookHeaderID = Convert.ToInt64(dt.Rows[0]["PurchaseSaleBookHeaderID"]);
                        header.VoucherTypeCode          = Convert.ToString(dt.Rows[0]["VoucherTypeCode"]);
                        header.VoucherDate    = Convert.ToDateTime(dt.Rows[0]["VoucherDate"]);
                        header.PurchaseBillNo = Convert.ToString(dt.Rows[0]["PurchaseBillNo"]);
                        header.LedgerType     = Convert.ToString(dt.Rows[0]["LedgerType"]);
                        header.LedgerTypeCode = Convert.ToString(dt.Rows[0]["LedgerTypeCode"]);
                        header.LocalCentral   = Convert.ToString(dt.Rows[0]["LocalCentral"]);
                        header.OldPurchaseSaleBookHeaderID = Convert.ToInt64(dt.Rows[0]["OldPurchaseSaleBookHeaderID"]);
                        header.PurchaseEntryFormID         = Convert.ToInt32(dt.Rows[0]["PurchaseEntryFormID"]);
                    }
                }
                return(header);
            }
            catch (DbEntityValidationException ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public long InsertUpdateTempPurchaseBookHeader(PharmaBusinessObjects.Transaction.PurchaseSaleBookHeader header)
        {
            try
            {
                long PurchaseSaleBookHeaderID = 0;

                string ConnString = ConfigurationManager.ConnectionStrings["PharmaDBConn"].ConnectionString;

                using (SqlConnection connection = new SqlConnection(ConnString))
                {
                    SqlCommand cmd = new SqlCommand("InsertUpdateInvetoryHeadersInTempTable", connection);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    List <PharmaBusinessObjects.Transaction.PurchaseSaleBookHeader> list = new List <PharmaBusinessObjects.Transaction.PurchaseSaleBookHeader>();
                    list.Add(header);

                    SqlParameter parameter = new SqlParameter();
                    parameter.SqlDbType     = SqlDbType.Structured;
                    parameter.TypeName      = "dbo.TableTypePurchaseSaleBookHeader";
                    parameter.ParameterName = "@TableTypePurchaseSaleBookHeader";
                    parameter.Value         = CommonDaoMethods.CreateDataTable <PharmaBusinessObjects.Transaction.PurchaseSaleBookHeader>(list);

                    cmd.Parameters.Add(parameter);

                    SqlDataAdapter sda = new SqlDataAdapter(cmd);
                    DataTable      dt  = new DataTable();

                    sda.Fill(dt);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        PurchaseSaleBookHeaderID = Convert.ToInt64(dt.Rows[0]["PurchaseSaleBookHeaderID"]);
                    }
                }

                return(PurchaseSaleBookHeaderID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }