public static int InsertYCWebService(YC_WEBSERVICE_DTO yc)
        {
            provider.connect();
            string sqlCommand = "sp_Insert_ycwebservice";
            List<SqlParameter> list = new List<SqlParameter>();

            list.Add(new SqlParameter("@username", yc.UserName));
            list.Add(new SqlParameter("@link", yc.LinkWebSite));
            list.Add(new SqlParameter("@email", yc.Email));
            list.Add(new SqlParameter("@tendoanhnghiep", yc.Tendn));
            list.Add(new SqlParameter("@linkws", yc.LinkWS));
            list.Add(new SqlParameter("@mcusername", yc.McUserName));
            list.Add(new SqlParameter("@mcpassword", yc.McPassWord));

            try
            {
                return provider.executeNonQueryProcedure(sqlCommand, list);

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                provider.disconnect();
            }
        }
 public static List<YC_WEBSERVICE_DTO> GetRequest()
 {
     provider.connect();
     string sqlCommand = "sp_SelectRequest";
     List<SqlParameter> list = new List<SqlParameter>();
     try
     {
         List<YC_WEBSERVICE_DTO> ycs = new List<YC_WEBSERVICE_DTO>();
         DataTable table = provider.executeQueryDataTableProcedure(sqlCommand, list);
         if (table != null && table.Rows.Count > 0)
         {
             foreach (DataRow row in table.Rows)
             {
                 YC_WEBSERVICE_DTO yc = new YC_WEBSERVICE_DTO();
                 yc.Ma =int.Parse( row["MA"].ToString());
                 yc.LinkWebSite = row["LINK"].ToString();
                 yc.LinkWS = row["LINKWS"].ToString();
                 yc.Email = row["EMAIL"].ToString();
                 yc.Tendn = row["TENDN"].ToString();
                 yc.TinhTrangYeuCau =int.Parse( row["TINHTRANGYC"].ToString());
                 ycs.Add(yc);
             }
         }
         return ycs;
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         provider.disconnect();
     }
 }
        protected void btYeuCau_Click(object sender, EventArgs e)
        {
            if (captcha.UserValidated)
            {
                lbCaptcha.Visible = false;
                YC_WEBSERVICE_DTO yc = new YC_WEBSERVICE_DTO();

                yc.UserName = txtUsername.Text;
                string pass = MD5.encryptPassword(txtPass.Text);
                yc.Tendn = txtTenHeThongMuaChung.Text;
                yc.Email = txtEmail.Text;
                yc.LinkWebSite = txtLink.Text;
                yc.LinkWS = txtLinkWS.Text;
                yc.McUserName = txtMCUsernme.Text;
                yc.McPassWord = txtMCPass.Text;

                try
                {
                    int kq = YCWebServiceBUS.ValidateUserName(yc.UserName, pass);
                    if (kq == 1)
                    {
                        try
                        {
                            YCWebServiceBUS.InsertYCWebService(yc);
                            Panel1.Visible = false;
                            Button1.Visible = true;
                            lbThongBao.Text = "<b style='color:red ' ><br />Yêu cầu của bạn đã được gửi đi thành công!</b>";
                        }
                        catch (Exception ex)
                        {

                            throw ex;
                        }
                    }
                    else
                    {
                        lbThongBao.Text = "<b style='color:red ' ><br/> Không thành công! username, pass không đúng hoặc trạng thái của bạn chưa active!</b>";
                        Panel1.Visible = true;
                        Button1.Visible = false;
                    }
                }
                catch (Exception ex)
                {

                    throw ex;

                }
            }
            else
            {
                lbCaptcha.Visible = true;
            }
        }
Exemple #4
0
        public static int InsertYCWebService(YC_WEBSERVICE_DTO yc)
        {
            try
            {
                int kq = YeuCauWebserviceDAO.InsertYCWebService(yc);
                return kq;
            }
            catch (Exception e)
            {

                throw e;
            }
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     List<YC_WEBSERVICE_DTO> list = new List<YC_WEBSERVICE_DTO>();
     int n = GridView1.Rows.Count;
     for (int i = 0; i < n; i++)
     {
         YC_WEBSERVICE_DTO yc = new YC_WEBSERVICE_DTO();
         yc.Ma =int.Parse( GridView1.DataKeys[i].Value.ToString());
         DropDownList drop=(DropDownList )GridView1.Rows[i].FindControl("DropDownList1");
         yc.TinhTrangYeuCau = int.Parse(drop.SelectedValue);
         yc.Email = GridView1.Rows[i].Cells[2].Text;
         list.Add(yc);
     }
     YCWebServiceBUS.UpdateStatusRequest(list);
     /*GridView1.DataSource = YCWebServiceBUS.SelectNewRequest();
     GridView1.DataBind();*/
     GridRequestDataBind();
 }
 public static List<YC_WEBSERVICE_DTO> SelectNewRequest()
 {
     provider.connect();
     string sqlCommand = "sp_SelectAllNewRequest";
     List<SqlParameter> list = new List<SqlParameter>();
     List<YC_WEBSERVICE_DTO> ws = new List<YC_WEBSERVICE_DTO>();
     try
     {
         DataTable table = provider.executeQueryDataTableProcedure(sqlCommand, list);
         if (table != null && table.Rows.Count > 0)
         {
             int n = table.Rows.Count;
             for (int i = 0; i < n; i++)
             {
                 DataRow row = table.Rows[i];
                 YC_WEBSERVICE_DTO yc = new YC_WEBSERVICE_DTO();
                 yc.Ma =int.Parse( row["MA"].ToString());
                 yc.Tendn = row["TENDN"].ToString();
                 yc.LinkWebSite = row["LINK"].ToString();
                 yc.Email = row["EMAIL"].ToString();
                 ws.Add(yc);
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         provider.disconnect();
     }
     return ws;
 }