Exemplo n.º 1
0
        public void FetchCompany()
        {
            CompanyDAL CompDAL = new CompanyDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            GVCompany.DataSource = CompDAL.GetCompany(null);
            GVCompany.DataBind();
        }
Exemplo n.º 2
0
        public IActionResult Review()
        {
            var        aesUserData = User.FindFirst(ClaimTypes.UserData).Value;
            var        UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));
            var        xid         = UserData.COMPANY_XID;
            B2dCompany model       = CompanyDAL.GetCompany(xid);

            return(View(model));
        }
Exemplo n.º 3
0
        public B2dCompany GetCompany(Int64 xid)
        {
            var comp = CompanyDAL.GetCompany(xid);

            //狀態語系文字對應
            comp.STATUS_DESC = GetFieldStatus(comp.STATUS);

            return(comp);
        }
Exemplo n.º 4
0
        private void FillCompany(String Name)
        {
            CompanyDAL Compdal = new CompanyDAL();

            Compdal.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();

            List <Company> CompanyList = Compdal.GetCompany(Name);

            gvCompany.DataSource = CompanyList;
            gvCompany.DataBind();
        }
Exemplo n.º 5
0
    private void SetAdditionalData()
    {
        if (CompanyID != 0)
        {
            CompanyDAL comp = new CompanyDAL();
            _CompanyInfo = comp.GetCompany(CompanyID);

            PropertyDAL prop = new PropertyDAL();
            _PropertyInfo = prop.GetProperties(CompanyID);
        }
    }
Exemplo n.º 6
0
        protected void BtnExport_Click(object sender, EventArgs e)
        {
            CompanyDAL Compdal = new CompanyDAL();

            Compdal.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
            List <Company> CompanyList = Compdal.GetCompany(null);

            var mem       = new MemoryStream();
            var writer    = new StreamWriter(mem, Encoding.UTF8, 1024, true);
            var csvWriter = new CsvWriter(writer);


            csvWriter.Configuration.Delimiter = ",";

            csvWriter.WriteField("Name");
            csvWriter.WriteField("Country");
            csvWriter.WriteField("NameAr");
            csvWriter.WriteField("Site");
            csvWriter.NextRecord();

            int lenght = CompanyList.Count - 1;

            for (int i = 0; i <= lenght; i++)
            {
                csvWriter.WriteField(CompanyList[i].Name);
                csvWriter.WriteField(CompanyList[i].Country);
                csvWriter.WriteField(CompanyList[i].NameAr);
                csvWriter.WriteField(CompanyList[i].Site);
                csvWriter.NextRecord();
            }
            writer.Flush();
            var data = Encoding.UTF8.GetString(mem.ToArray());

            Response.Clear();
            Response.AddHeader("content-disposition", "attachment; filename=Company.csv");
            Response.Charset     = "";
            Response.ContentType = "text/csv";
            Response.Write(data.ToString());
            Response.End();
        }
Exemplo n.º 7
0
        protected void FetchCompaniesList()
        {
            //MySqlConnection connection = new MySqlConnection
            //{
            //ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            //};

            //MySqlCommand command = new MySqlCommand("SELECT Name FROM  `shobingg_P2M_Operations`.`Clients Invoices` group by Company", connection)
            //{
            //CommandType = System.Data.CommandType.Text
            //};

            //MySqlDataAdapter dataAdapter = new MySqlDataAdapter("SELECT ID,Name FROM  `shobingg_P2M_Operations`.`Company` ", connection);

            //DataTable dataTable = new DataTable();

            //dataAdapter.Fill(dataTable);

            //connection.Open();

            //CompaniesList.DataSource = dataTable;
            //CompaniesList.DataTextField = "Name";
            //CompaniesList.DataValueField = "ID";
            //CompaniesList.DataBind();

            //connection.Close();

            CompanyDAL companies = new CompanyDAL
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            CompaniesList.DataSource     = companies.GetCompany(null);
            CompaniesList.DataTextField  = "Name";
            CompaniesList.DataValueField = "ID";
            CompaniesList.DataBind();
            CompaniesList.Items.Insert(0, new ListItem("--Select Company--", "0"));
        }