コード例 #1
0
        private static string UpdateCustomInvoice(Custom_Invoice _Custom_Invoice)
        {
            DbCommand command = Catalog_Access.CreateCommand();
            //Have to wite the stored procedure
            command.CommandText = "sp_update_Custom_Invoice";

            DbParameter param;

            #region
            param = command.CreateParameter();
            param.ParameterName = "@ID";
            param.Value = _Custom_Invoice.ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Consigned_To";
            param.Value = _Custom_Invoice.Consigned_To;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Country";
            param.Value = _Custom_Invoice.Country;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@ExchangeRate";
            param.Value = _Custom_Invoice.ExchangeRate;
            param.DbType = DbType.Decimal;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@CurrencyID";
            param.Value = _Custom_Invoice.CurrencyID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@BankID";
            param.Value = _Custom_Invoice.BankID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Supplier_Origin";
            param.Value = _Custom_Invoice.Supplier_Origin;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@LCNo";
            param.Value = _Custom_Invoice.LCNo;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@LCDate";
            param.Value = _Custom_Invoice.LCDate;
            param.DbType = DbType.Date;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Customer_Destination";
            param.Value = _Custom_Invoice.Customer_Destination;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Date";
            param.Value = _Custom_Invoice.Date;
            param.DbType = DbType.Date;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@From_E_No";
            param.Value = _Custom_Invoice.From_E_No;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Branch";
            param.Value = _Custom_Invoice.Branch;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Payment_Terms";
            param.Value = _Custom_Invoice.Payment_Terms;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Vessel";
            param.Value = _Custom_Invoice.Vessel;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@UpdatedBy";
            param.Value = _Custom_Invoice.UpdatedBy;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType = DbType.Int32;
            param.Direction = ParameterDirection.Output;
            command.Parameters.Add(param);
            #endregion

            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            return Return;
        }
コード例 #2
0
 //insert
 public static string Insert(Custom_Invoice _Custom_Invoice, List<Custom_Invoice_B> _Custom_Invoice_B)
 {
     if (InsertCustomInvoice(_Custom_Invoice) == "0")
     {
         InsertCustomCollection(_Custom_Invoice_B, _Custom_Invoice.ID, _Custom_Invoice.CreatedBy);
         return "0";
     }
     else
     {
         return "1";
     }
 }
コード例 #3
0
 // update
 public static string Update(Custom_Invoice _Custom_Invoice, List<Custom_Invoice_B> _Custom_Invoice_B)
 {
     if (UpdateCustomInvoice(_Custom_Invoice) == "4")
     {
         UpdateCollection(_Custom_Invoice_B, _Custom_Invoice.ID, _Custom_Invoice.UpdatedBy);
         return "4";
     }
     else
     {
         return "1";
     }
 }
        public Custom_Invoice Get_Custom_Invoice(int ID)
        {
            // Customer Detail
            Custom_Invoice _Custom_Invoice = new Custom_Invoice();

            DataTable dt = Custom_Invoice_DA.Get_Custom_Invoice(ID);
            string test = dt.Rows[0]["Customer_ID"].ToString();
            _Custom_Invoice.Customer_ID = int.Parse(dt.Rows[0]["Customer_ID"].ToString());
            _Custom_Invoice.Proforma_Invoice_ID = int.Parse(dt.Rows[0]["Proforma_Invoice_ID"].ToString());
            _Custom_Invoice.ID = int.Parse(dt.Rows[0]["ID"].ToString());
            _Custom_Invoice.Consigned_To = dt.Rows[0]["Consigned_To"].ToString();
            _Custom_Invoice.Country = dt.Rows[0]["Country"].ToString();
            _Custom_Invoice.ExchangeRate = float.Parse(dt.Rows[0]["ExchangeRate"].ToString());
            _Custom_Invoice.CurrencyID = int.Parse(dt.Rows[0]["CurrencyID"].ToString());
            _Custom_Invoice.BankID = int.Parse(dt.Rows[0]["BankID"].ToString());
            _Custom_Invoice.LCNo = dt.Rows[0]["LCNo"].ToString();
            _Custom_Invoice.Supplier_Origin = dt.Rows[0]["Supplier_Origin"].ToString();
            _Custom_Invoice.Customer_Destination = dt.Rows[0]["Customer_Destination"].ToString();
            _Custom_Invoice.Custom_Invoice_No = dt.Rows[0]["Custom_Invoice_No"].ToString();
            _Custom_Invoice.DateString = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).ToString("MM/dd/yyyy");
            if (dt.Rows[0]["LCDate"].ToString() != "")
                _Custom_Invoice.LCDateString = Convert.ToDateTime(dt.Rows[0]["LCDate"].ToString()).ToString("MM/dd/yyyy");
            _Custom_Invoice.From_E_No = dt.Rows[0]["From_E_No"].ToString();
            _Custom_Invoice.Branch = dt.Rows[0]["Branch"].ToString();
            _Custom_Invoice.Payment_Terms = dt.Rows[0]["Payment_Terms"].ToString();
            _Custom_Invoice.Vessel = dt.Rows[0]["Vessel"].ToString();

            _Custom_Invoice.CurrencyName = dt.Rows[0]["CurrencyName"].ToString();
            _Custom_Invoice.CurrencyDescription = dt.Rows[0]["CurrencyDescription"].ToString();

            return _Custom_Invoice;
        }
        public string Submit(Custom_Invoice _Custom_Invoice, List<Custom_Invoice_B> _Custom_Invoice_B)
        {
            string msg = "";

            if (_Custom_Invoice_B[0].ID == null)
            {
                _Custom_Invoice.CreatedBy = Session["User"].ToString();
                msg = Custom_Invoice_DA.Insert(_Custom_Invoice, _Custom_Invoice_B);

            }
            else
            {
                _Custom_Invoice.UpdatedBy = Session["User"].ToString();
                msg = Custom_Invoice_DA.Update(_Custom_Invoice, _Custom_Invoice_B);
            }

            return msg;
        }
        public Custom_Invoice GetCustomInfoByCustomInvoiceID(int Custom_Invoice_ID)
        {
            Custom_Invoice _Custom_Invoice = new Custom_Invoice();

            DataTable dt = Custom_Invoice_DA.GetCustomInfoByCustomInvoiceID(Custom_Invoice_ID);
            _Custom_Invoice.Customer_ID = int.Parse(dt.Rows[0]["Customer_ID"].ToString());
            _Custom_Invoice.Supplier_Origin = dt.Rows[0]["Supplier_Origin"].ToString();
            _Custom_Invoice.Customer_Destination = dt.Rows[0]["Customer_Destination"].ToString();
            _Custom_Invoice.Consigned_To = dt.Rows[0]["Bank_Name"].ToString();
            _Custom_Invoice.Country = dt.Rows[0]["Country"].ToString();

            _Custom_Invoice.Payment_Terms = dt.Rows[0]["Payment_Terms"].ToString();
            return _Custom_Invoice;
        }
コード例 #7
0
        private static string UpdateCustomInvoice(Custom_Invoice _Custom_Invoice)
        {
            DbCommand command = Catalog_Access.CreateCommand();
            //Have to wite the stored procedure
            command.CommandText = "sp_update_Custom_Invoice_For_Proforma_Binding";

            DbParameter param;

            #region
            param = command.CreateParameter();
            param.ParameterName = "@ID";
            param.Value = _Custom_Invoice.ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Custom_Invoice_No";
            param.Value = _Custom_Invoice.Custom_Invoice_No;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType = DbType.Int32;
            param.Direction = ParameterDirection.Output;
            command.Parameters.Add(param);
            #endregion

            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            return Return;
        }
コード例 #8
0
 //update
 public static string Update(Custom_Invoice _Custom_Invoice, List<Proforma_Binding> _Proforma_Binding)
 {
     if (UpdateCustomInvoice(_Custom_Invoice) == "4")
     {
         UpdateCollection(_Proforma_Binding, _Custom_Invoice.ID, _Custom_Invoice.UpdatedBy);
         return "4";
     }
     else
     {
         return "1";
     }
 }
コード例 #9
0
        //public static int Delete(int ID)
        //{
        //    DbCommand command = Catalog_Access.CreateCommand();
        //    command.CommandText = "sp_Delete_Proforma_Binding_By_Id";
        //    DbParameter param;
        //    param = command.CreateParameter();
        //    param.ParameterName = "@ID";
        //    param.Value = ID;
        //    param.DbType = DbType.Int32;
        //    command.Parameters.Add(param);
        //    return Catalog_Access.ExecuteNonQuery(command);
        //}
        //insert
        public static string Insert(Custom_Invoice _Custom_Invoice, List<Proforma_Binding> _Proforma_Binding)
        {
            int ID = InsertCustomInvoice(_Custom_Invoice);

            if (ID > 0)
            {
                InsertCollection(_Proforma_Binding, ID, _Custom_Invoice.CreatedBy);
                return "0";
            }
            else
            {
                return "1";
            }
        }
        public string Submit(Custom_Invoice _Custom_Invoice, List<Proforma_Binding> _Proforma_Binding)
        {
            string msg = "";

            if (_Custom_Invoice.ID == null)
            {
                _Custom_Invoice.CreatedBy = Session["User"].ToString();
                msg = Proforma_Binding_DA.Insert(_Custom_Invoice, _Proforma_Binding);

            }
            else
            {
                _Custom_Invoice.UpdatedBy = Session["User"].ToString();
                msg = Proforma_Binding_DA.Update(_Custom_Invoice, _Proforma_Binding);
            }

            return msg;
        }