Esempio n. 1
0
        public ActionResult _SupplierInforPartial(ReportSearchViewModel model)
        {
            var SupInfo = new ReportSupInforViewModel();

            try
            {
                using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
                {
                    using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand())
                    {
                        cmd.CommandText = "usp_ThongTinCongNoNhaCungCap";
                        cmd.Parameters.AddWithValue("@SupplierId", model.SupplierId);
                        cmd.Parameters.AddWithValue("@FromDateSup", model.FromDateSup);
                        cmd.Parameters.AddWithValue("@ToDateSup", model.ToDateSup);
                        cmd.Connection  = conn;
                        cmd.CommandType = CommandType.StoredProcedure;
                        conn.Open();
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.Read())
                        {
                            SupInfo = SingleViewSup(dr);
                        }
                        conn.Close();
                        return(PartialView(SupInfo));
                    }
                }
            }
            catch
            {
                return(PartialView(SupInfo));
            }
        }
Esempio n. 2
0
        public ReportSupInforViewModel ListView(SqlDataReader s)
        {
            ReportSupInforViewModel ret = new ReportSupInforViewModel();

            try
            {
                if (s["SupplierId"] != null)
                {
                    ret.SupplierId = Int32.Parse(s["SupplierId"].ToString());
                }

                if (s["SupplierName"] != null)
                {
                    ret.SupplierName = s["SupplierName"].ToString();
                }

                if (s["Phone"] != null)
                {
                    ret.Phone = s["Phone"].ToString();
                }

                if (s["Email"] != null)
                {
                    ret.Email = s["Email"].ToString();
                }

                if (s["SoDuNoDauKy"] != DBNull.Value)
                {
                    ret.SoDuNoDauKy = decimal.Parse(s["SoDuNoDauKy"].ToString());
                }

                if (s["SoDuNoCuoiKy"] != DBNull.Value)
                {
                    ret.SoDuNoCuoiKy = decimal.Parse(s["SoDuNoCuoiKy"].ToString());
                }
            }
            catch { }
            return(ret);
        }
Esempio n. 3
0
        public ReportSupInforViewModel SingleViewSup(SqlDataReader s)
        {
            ReportSupInforViewModel ret = new ReportSupInforViewModel();

            try
            {
                if (s["SupplierName"] != null)
                {
                    ret.SupplierName = s["SupplierName"].ToString();
                }

                if (s["Phone"] != null)
                {
                    ret.Phone = s["Phone"].ToString();
                }

                if (s["Email"] != null)
                {
                    ret.Email = s["Email"].ToString();
                }

                if (s["Address"] != null)
                {
                    ret.Address = s["Address"].ToString();
                }

                if (s["ProvinceName"] != null)
                {
                    ret.ProvinceName = s["ProvinceName"].ToString();
                }

                if (s["DistrictName"] != null)
                {
                    ret.DistrictName = s["DistrictName"].ToString();
                }

                if (s["BankName"] != null)
                {
                    ret.BankName = s["BankName"].ToString();
                }

                if (s["BankAccountNumber"] != null)
                {
                    ret.BankAccountNumber = s["BankAccountNumber"].ToString();
                }

                if (s["BankOwner"] != null)
                {
                    ret.BankOwner = s["BankOwner"].ToString();
                }

                if (s["NoPhaiTra"] != DBNull.Value)
                {
                    ret.NoPhaiTra = decimal.Parse(s["NoPhaiTra"].ToString());
                }

                if (s["SoDuNoDauKy"] != DBNull.Value)
                {
                    ret.SoDuNoDauKy = decimal.Parse(s["SoDuNoDauKy"].ToString());
                }

                if (s["SoDuNoCuoiKy"] != DBNull.Value)
                {
                    ret.SoDuNoCuoiKy = decimal.Parse(s["SoDuNoCuoiKy"].ToString());
                }
            }
            catch { }
            return(ret);
        }