コード例 #1
0
ファイル: Form_TimKiemBaoG.cs プロジェクト: dtsonvt/IPC247New
 private void dgv_Main_RowClick(object sender, RowClickEventArgs e)
 {
     try
     {
         int focus = dgv_Main.FocusedRowHandle;
         if (focus >= 0)
         {
             dgv_Main.SetMasterRowExpanded(focus, !dgv_Main.GetMasterRowExpanded(focus));
             InfoCustomer ob = (InfoCustomer)dgv_Main.GetFocusedRow();
             ID = ob.ID;
         }
     }
     catch (Exception ex)
     {
         API.API_ERRORLOG(new ERRORLOG(Form_Main.IPAddress, "Form_TimKiemBaoGia", "dgv_Main_RowClick", ex.ToString()));
         ID = "0";
     }
 }
コード例 #2
0
        private void ChonVaThoat()
        {
            btnChonVaThoat.Enabled = false;
            InfoCustomer ob = listob.Find(o => o.ID == ID);

            if (ob == null)
            {
                if (listob.Count == 0)
                {
                    Form_Quote.QuoteChoose = null;
                }
            }
            else
            {
                Form_Quote.QuoteChoose = GetQuote_Detail_RealTime(ID);
                this.Close();
            }
            btnChonVaThoat.Enabled = true;
        }
コード例 #3
0
 private void LoadBaoGiaAll(string ID)
 {
     try
     {
         string sql_Exect = string.Format("Exec sp_GetQuote_Detail " +
                                          "@ID={0}", ID); //11
         string    sLink         = Form_Main.URL_API + "/api/IPC247/sp_extension_GetDataByQueryString?str_Query=" + sql_Exect;
         var       json          = API.API_GET(sLink);
         dynamic   jsondata      = JObject.Parse(json);
         var       jsondataChild = jsondata.GetValue("Data");
         DataTable dt            = (DataTable)JsonConvert.DeserializeObject(jsondataChild.ToString(), (typeof(DataTable)));
         listob = new List <InfoCustomer>();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             InfoCustomer ob = new InfoCustomer();
             ob.ID               = dt.Rows[i]["ID"].ToString();
             ob.SoBaoGia         = dt.Rows[i]["SoBaoGia"].ToString();
             ob.ToKhachHang      = dt.Rows[i]["ToKhachHang"].ToString();
             ob.NguoiNhan        = dt.Rows[i]["NguoiNhan"].ToString();
             ob.Mobile_NguoiNhan = dt.Rows[i]["Mobile_NguoiNhan"].ToString();
             ob.Tel_NguoiNhan    = dt.Rows[i]["Tel_NguoiNhan"].ToString();
             ob.Email_NguoiNhan  = dt.Rows[i]["Email_NguoiNhan"].ToString();
             ob.VAT              = int.Parse(dt.Rows[i]["VAT"].ToString());
             ob.NgayBaoGia       = dt.Rows[i]["NgayBaoGia"].ToString();
             ob.CreateBy         = dt.Rows[i]["CreateBy"].ToString();
             ob.CreateDate       = dt.Rows[i]["CreateDate"].ToString();
             ob.UpdateBy         = dt.Rows[i]["UpdateBy"].ToString();
             ob.UpdateDate       = dt.Rows[i]["UpdateDate"].ToString();
             ob.TongTien         = decimal.Parse(dt.Rows[i]["TongTien"].ToString());
             ob.TongTienAfterVat = decimal.Parse(dt.Rows[i]["TongTienSauThue"].ToString());
             ob.DiaChiKhachHang  = dt.Rows[i]["DiaChi"].ToString();
             ob.DieuKhoan        = dt.Rows[i]["DieuKhoan"].ToString();
             ob.ID_Enquiry       = dt.Rows[i]["ID_Enquiry"].ToString();
             ob.EnquiryName      = dt.Rows[i]["EnquiryName"].ToString();
             ob.IDCardCode       = dt.Rows[i]["IDCardCode"].ToString();
             ob.IDCompany        = dt.Rows[i]["IDCompany"].ToString();
             string xml = dt.Rows[i]["XML"].ToString();
             if (xml != "")
             {
                 XDocument dox = XDocument.Parse(dt.Rows[i]["XML"].ToString());
                 List <InfoReportDetails> lstSP = dox.Descendants("Quote").Select(d =>
                                                                                  new InfoReportDetails
                 {
                     ID          = d.Element("ID").Value,
                     MaSP        = d.Element("MaSP").Value,
                     TenHang     = d.Element("TenHang").Value,
                     MoTaHangHoa = d.Element("MoTa").Value,
                     DonGia      = decimal.Parse(d.Element("DonGia").Value),
                     SoLuong     = int.Parse(d.Element("Quantity").Value),
                     ChietKhau   = decimal.Parse(d.Element("ChietKhau").Value),
                     Profit      = decimal.Parse(d.Element("Profit").Value),
                     CostPrice   = decimal.Parse(d.Element("CostPrice").Value)
                 }).ToList();
                 ob.DSSanPham = lstSP;
             }
             listob.Add(ob);
         }
         dgc_Main.DataSource    = listob;
         dgv_detail.ViewCaption = "Thông Tin Chi Tiết";
         dgv_Main.BestFitColumns(true);
         dgv_detail.BestFitColumns(true);
     }
     catch (Exception ex)
     {
         API.API_ERRORLOG(new ERRORLOG(Form_Main.IPAddress, "Form_TimKiemBaoGia", "LoadBaoGiaAll", ex.ToString()));
     }
 }