コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SERVICE_TRANS_DTO service = new SERVICE_TRANS_DTO();
            service.TenCongTy = txtName.Text;
            service.LinkWebService = txtLink.Text;
            service.MaDV = int.Parse(hdfId.Value);
            service.TinhTrang = int.Parse(DropDownList1.SelectedValue);
            service.Website = txtWebsite.Text;
            try
            {
                int result = ServiceTransBUS.UpdateServiceTrans(service);
                if (result == 1)
                {
                    lbResult.ForeColor = Color.Green;
                    lbResult.Text = "Đã cập nhật thành công";
                }
                else
                {
                    lbResult.ForeColor = Color.Red;
                    lbResult.Text = "Đã có lỗi , xin vui lòng thử lại sau";
                }
            }
            catch (Exception ex)
            {

                lbResult.ForeColor = Color.Red;
                lbResult.Text = "Đã có lỗi , xin vui lòng thử lại sau";
            }
        }
コード例 #2
0
ファイル: ServiceTransBUS.cs プロジェクト: puentepr/ptudnhao
 public static int UpdateServiceTrans(SERVICE_TRANS_DTO service)
 {
     try
     {
         return ServiceTransDAO.UpdateServiceTrans(service);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #3
0
ファイル: ServiceTransBUS.cs プロジェクト: puentepr/ptudnhao
 public static int InsertServiceTrans(SERVICE_TRANS_DTO service)
 {
     try
     {
         int madv=ServiceTransDAO.InsertServiceTrans(service);
         if (madv == -1)
             return -1;
       /*  foreach (TransportType type in types)
         {
             type.Madv = madv;
             ServiceTransDAO.InsertTransType(type);
         }*/
         return 1;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     SERVICE_TRANS_DTO service = new SERVICE_TRANS_DTO();
     service.TenCongTy = txtName.Text;
     service.LinkWebService = txtLink.Text;
     service.UserName = txtUserName.Text;
     service.PassWord = txtPass.Text;
     service.Website = txtWebsite.Text;
     service.BizAddress = txtBizAddress.Text;
     try
     {
       /*  List<TransportType> transtypes = new List<TransportType>();
         for (int i = 0; i < grTransType.Rows.Count; i++)
         {
             TransportType trans = new TransportType();
             trans.MaHinhThucVanChuyen = i.ToString();
             trans.TenHinhThucVanChuyen = grTransType.Rows[i].Cells[0].Text;
             float price;
             float.TryParse(((TextBox)grTransType.Rows[i].FindControl("txtPrice")).Text, out price);
             trans.Gia = price;
             trans.DonViTien = ((TextBox)grTransType.Rows[i].FindControl("txtMoney")).Text;
             transtypes.Add(trans);
         }*/
         int result = ServiceTransBUS.InsertServiceTrans(service);
         if (result == 1)
         {
             lbResult.ForeColor = Color.Green;
             lbResult.Text = "Đã thêm thành công";
         }
         else
         {
             lbResult.ForeColor = Color.Red;
             lbResult.Text = "Lỗi hệ thống, vui lòng thử lại sau!";
         }
     }
     catch (Exception ex)
     {
         lbResult.ForeColor = Color.Red;
         lbResult.Text = "Lỗi hệ thống, vui lòng thử lại sau!";
     }
 }
コード例 #5
0
ファイル: ServiceTransDAO.cs プロジェクト: puentepr/ptudnhao
 private static void TransFerToListServiceTrans(List<SERVICE_TRANS_DTO> services, DataTable table)
 {
     int n = table.Rows.Count;
     for (int i = 0; i < n; i++)
     {
         DataRow row = table.Rows[i];
         SERVICE_TRANS_DTO sv = new SERVICE_TRANS_DTO();
         sv.MaDV = int.Parse(row["MADV"].ToString());
         sv.TenCongTy = row["TENCTY"].ToString();
         sv.LinkWebService = row["LINKWS"].ToString();
         sv.UserName = row["USERNAME"].ToString();
         sv.PassWord = row["PASS_WORD"].ToString();
         sv.TinhTrang = int.Parse(row["TINHTRANG"].ToString());
         sv.Title = "Cập nhật";
         sv.Website = row["WEBSITE"].ToString();
         sv.BizAddress = row["BIZADDRESS"].ToString();
         services.Add(sv);
     }
 }
コード例 #6
0
ファイル: ServiceTransDAO.cs プロジェクト: puentepr/ptudnhao
 public static int UpdateServiceTrans(SERVICE_TRANS_DTO service)
 {
     provider.connect();
     string sqlCommand="sp_UpdateServiceTrans";
     List<SqlParameter>list=new List<SqlParameter>();
     list.Add(new SqlParameter("@madv",service.MaDV));
     list.Add(new SqlParameter("@tencty",service.TenCongTy));
     list.Add(new SqlParameter("@linkws",service.LinkWebService));
        // list.Add(new SqlParameter("@username",service.UserName));
        // list.Add(new SqlParameter("@password",service.PassWord));
     list.Add(new SqlParameter("@website",service.Website));
     list.Add(new SqlParameter("@tinhtrang", service.TinhTrang));
     SqlParameter result=new SqlParameter("@result",SqlDbType.Int);
     result.Direction=ParameterDirection.ReturnValue;
     list.Add(result);
     try
     {
         provider.executeNonQueryProcedure(sqlCommand, list);
         return (int)result.Value;
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         provider.disconnect();
     }
 }