Ejemplo n.º 1
0
        public GRVListImport UpdateTemp(GRVListImport ins)
        {
            //...Get User and Date Data...
            string ModifiedDate = string.Format("{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now);
            string EmployeeId   = Convert.ToString(HttpContext.Current.Session["Username"]);

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();

            con.Open();
            SqlCommand cmdI = con.CreateCommand();

            cmdI.Connection = con;

            //...Update Record...
            cmdI.Parameters.Clear();
            cmdI.CommandText = StoredProcedures.GRVTempUpdate;
            cmdI.CommandType = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@GRVListID", ins.GRVListID);
            cmdI.Parameters.AddWithValue("@SupplierID", ins.SupplierID);
            cmdI.Parameters.AddWithValue("@ModifiedDate", ModifiedDate);
            cmdI.Parameters.AddWithValue("@ModifiedBy", EmployeeId);
            cmdI.Parameters.AddWithValue("@hasError", ins.hasError);

            cmdI.ExecuteNonQuery();
            cmdI.Connection.Close();

            return(ins);
        }
Ejemplo n.º 2
0
        public List <GRVListImport> GetAllGRVList(bool check)
        {
            //...Create New Instance of Object...
            List <GRVListImport> list = new List <GRVListImport>();
            GRVListImport        ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT * FROM temp_GRVList", con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins                 = new GRVListImport();
                    ins.GRVListID       = Convert.ToInt32(drI["GRVListID"]);
                    ins.InvoiceNumber   = Convert.ToString(drI["InvoiceNumber"]);
                    ins.StateDate       = Convert.ToDateTime(drI["StateDate"]);
                    ins.Number          = Convert.ToInt32(drI["Number"]);
                    ins.PayDate         = Convert.ToDateTime(drI["PayDate"]);
                    ins.PinkSlipNumber  = Convert.ToString(drI["PinkSlipNumber"]);
                    ins.GRVDate         = Convert.ToDateTime(drI["GRVDate"]);
                    ins.InvoiceDate     = Convert.ToDateTime(drI["InvoiceDate"]);
                    ins.ExcludingVat    = Convert.ToDecimal(drI["ExcludingVat"]);
                    ins.IncludingVat    = Convert.ToDecimal(drI["IncludingVat"]);
                    ins.CreatedDate     = Convert.ToDateTime(drI["CreatedDate"]);
                    ins.GRVTypeID       = Convert.ToInt32(drI["GRVTypeID"]);
                    ins.SupplierID      = Convert.ToInt32(drI["SupplierID"]);
                    ins.CompanyID       = Convert.ToInt32(drI["CompanyID"]);
                    ins.ModifiedDate    = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.ModifiedBy      = Convert.ToString(drI["ModifiedBy"]);
                    ins.Removed         = Convert.ToBoolean(drI["Removed"]);
                    ins.hasError        = Convert.ToBoolean(drI["hasError"]);
                    ins.SupplierDetails = Convert.ToString(drI["SupplierDetails"]);
                    ins.Suppliers       = ins.SupplierDetails;
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();


            //...Return...
            return(list);
        }
Ejemplo n.º 3
0
        public void UpdateImports()
        {
            List <GRVListImport> all = GetAllGRVList(true);

            foreach (GRVListImport imp in all)
            {
                if (imp.SupplierID == 0)
                {
                    if (GetSupplierByName(imp.SupplierDetails) != 0)
                    {
                        int supid = GetSupplierByName(imp.SupplierDetails);
                        imp.SupplierID = supid;
                        imp.PayDate    = GetPaymentDate(imp.SupplierID, imp.GRVDate);
                        imp.hasError   = false;
                        GRVListImport imp2 = UpdateTemp(imp);
                    }
                }
            }
        }
        public GRVList ConvertToOther(GRVListImport ins)
        {
            GRVList ret = new GRVList();
            ret.CompanyID = ins.CompanyID;
            ret.CreatedDate = ins.CreatedDate;
            ret.ExcludingVat = ins.ExcludingVat;
            ret.GRVDate = ins.GRVDate;
            ret.GRVTypeID = ins.GRVTypeID;
            ret.IncludingVat = ins.IncludingVat;
            ret.InvoiceDate = ins.InvoiceDate;
            ret.InvoiceNumber = ins.InvoiceNumber;
            ret.ModifiedBy = ins.ModifiedBy;
            ret.ModifiedDate = ins.ModifiedDate;
            ret.Number = ins.Number;
            ret.PayDate = GetPaymentDate(ins.SupplierID, ins.GRVDate);
            ret.PinkSlipNumber = ins.PinkSlipNumber;
            ret.StateDate = ins.StateDate;
            ret.SupplierID = ins.SupplierID;
            ret.ExpectedPayDate = GetExpectedPayDate(ins.PinkSlipNumber, ins.SupplierID);

            return ret;
        }
Ejemplo n.º 5
0
        public GRVList ConvertToOther(GRVListImport ins)
        {
            GRVList ret = new GRVList();

            ret.CompanyID       = ins.CompanyID;
            ret.CreatedDate     = ins.CreatedDate;
            ret.ExcludingVat    = ins.ExcludingVat;
            ret.GRVDate         = ins.GRVDate;
            ret.GRVTypeID       = ins.GRVTypeID;
            ret.IncludingVat    = ins.IncludingVat;
            ret.InvoiceDate     = ins.InvoiceDate;
            ret.InvoiceNumber   = ins.InvoiceNumber;
            ret.ModifiedBy      = ins.ModifiedBy;
            ret.ModifiedDate    = ins.ModifiedDate;
            ret.Number          = ins.Number;
            ret.PayDate         = GetPaymentDate(ins.SupplierID, ins.GRVDate);
            ret.PinkSlipNumber  = ins.PinkSlipNumber;
            ret.StateDate       = ins.StateDate;
            ret.SupplierID      = ins.SupplierID;
            ret.ExpectedPayDate = GetExpectedPayDate(ins.PinkSlipNumber, ins.SupplierID);

            return(ret);
        }
        public JsonResult _AddSupplier(GRVListImport ins)
        {
            //...Update Object
            if (ins.SupplierID == 0)
            {
                //...Insert Supplier
                Supplier sup = new Supplier();
                sup.CompanyID = 0;
                sup.CreatedDate = DateTime.Now;
                sup.FromFriday = ins.FromFriday;
                sup.StockCondition = ins.StockCondition;
                sup.Suppliers = ins.Suppliers;
                sup.SupplierTypeID = ins.SupplierTypeID;
                sup.Term = ins.Term;

                sup = SupRep.Insert(sup);
                ins.SupplierID = sup.SupplierID;
                ins.hasError = (ins.SupplierID == 0) ? true: false;
                GRVListImport ins2 = GRVRep.UpdateTemp(ins);

                //...Update all similair
                GRVRep.UpdateImports();
            }
            else
            {
                //...Update only single one
                ins.hasError = (ins.SupplierID == 0) ? true : false;
                GRVListImport ins2 = GRVRep.UpdateTemp(ins);

                GRVRep.UpdateImports();
            }

            //...Repopulate Grid...
            return Json(new GridModel(GRVRep.GetAllGRVList(ins.BatchId)));
        }
        public List<GRVListImport> GetAllGRVList(bool check)
        {
            //...Create New Instance of Object...
            List<GRVListImport> list = new List<GRVListImport>();
            GRVListImport ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT * FROM temp_GRVList", con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new GRVListImport();
                    ins.GRVListID = Convert.ToInt32(drI["GRVListID"]);
                    ins.InvoiceNumber = Convert.ToString(drI["InvoiceNumber"]);
                    ins.StateDate = Convert.ToDateTime(drI["StateDate"]);
                    ins.Number = Convert.ToInt32(drI["Number"]);
                    ins.PayDate = Convert.ToDateTime(drI["PayDate"]);
                    ins.PinkSlipNumber = Convert.ToString(drI["PinkSlipNumber"]);
                    ins.GRVDate = Convert.ToDateTime(drI["GRVDate"]);
                    ins.InvoiceDate = Convert.ToDateTime(drI["InvoiceDate"]);
                    ins.ExcludingVat = Convert.ToDecimal(drI["ExcludingVat"]);
                    ins.IncludingVat = Convert.ToDecimal(drI["IncludingVat"]);
                    ins.CreatedDate = Convert.ToDateTime(drI["CreatedDate"]);
                    ins.GRVTypeID = Convert.ToInt32(drI["GRVTypeID"]);
                    ins.SupplierID = Convert.ToInt32(drI["SupplierID"]);
                    ins.CompanyID = Convert.ToInt32(drI["CompanyID"]);
                    ins.ModifiedDate = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.ModifiedBy = Convert.ToString(drI["ModifiedBy"]);
                    ins.Removed = Convert.ToBoolean(drI["Removed"]);
                    ins.hasError = Convert.ToBoolean(drI["hasError"]);
                    ins.SupplierDetails = Convert.ToString(drI["SupplierDetails"]);
                    ins.Suppliers = ins.SupplierDetails;
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();

            //...Return...
            return list;
        }
        public GRVListImport UpdateTemp(GRVListImport ins)
        {
            //...Get User and Date Data...
            string ModifiedDate = string.Format("{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now);
             string EmployeeId = Convert.ToString(HttpContext.Current.Session["Username"]);

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            con.Open();
            SqlCommand cmdI = con.CreateCommand();
            cmdI.Connection = con;

            //...Update Record...
            cmdI.Parameters.Clear();
            cmdI.CommandText = StoredProcedures.GRVTempUpdate;
            cmdI.CommandType = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@GRVListID", ins.GRVListID);
            cmdI.Parameters.AddWithValue("@SupplierID", ins.SupplierID);
            cmdI.Parameters.AddWithValue("@ModifiedDate", ModifiedDate);
            cmdI.Parameters.AddWithValue("@ModifiedBy", EmployeeId);
            cmdI.Parameters.AddWithValue("@hasError", ins.hasError);

            cmdI.ExecuteNonQuery();
            cmdI.Connection.Close();

            return ins;
        }