private void TaoMoi() { try { IDGroup = "0"; ProductGroupHeader ob = new ProductGroupHeader(); ob.ProductGroupName = txtTenNhom.Text; ob.CreateBy = Form_Main.user.Username; if (listHeader == null) { listHeader = new List <ProductGroupHeader>(); } listHeader.Add(ob); dgc_Main.DataSource = listHeader; dgv_Main.RefreshData(); dgv_Main.BestFitColumns(true); ProductGroupDetails obd = new ProductGroupDetails(); listdetails = new List <ProductGroupDetails>(); obd.SoLuong = 1; listdetails.Add(obd); dgcDetails.DataSource = listdetails; dgvDetails.RefreshData(); dgvDetails.BestFitColumns(true); } catch (Exception ex) { API.API_ERRORLOG(new ERRORLOG(Form_Main.IPAddress, "Form_Login", "TaoMoi()", ex.ToString())); } }
/// <summary> /// Sự kiện Selected Row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// private void SelectedRow() { try { int focus = dgv_Main.FocusedRowHandle; if (focus >= 0) { ProductGroupHeader ob = (ProductGroupHeader)dgv_Main.GetFocusedRow(); if (ob != null) { IDGroup = ob.ID; txtTenNhom.Text = ob.ProductGroupName.ToString(); string DSSanPham = ob.ListProductCode.ToString(); LoadInfoProductDetails(DSSanPham); } } } catch { IDGroup = "0"; ProductGroupDetails obd = new ProductGroupDetails(); listdetails = new List <ProductGroupDetails>(); obd.SoLuong = 1; listdetails.Add(obd); dgcDetails.DataSource = listdetails; dgvDetails.RefreshData(); dgvDetails.BestFitColumns(true); } }
public ProductGroupHeader(ProductGroupHeader ob) { ID = ob.ID; ProductGroupName = ob.ProductGroupName; ListProductCode = ob.ListProductCode; CreateBy = ob.CreateBy; CreateDate = ob.CreateDate; UpdateBy = ob.UpdateBy; UpdateDate = ob.UpdateDate; TongTien = ob.TongTien; }
/// <summary> /// Load Thông tin Nhóm Sản Phẩm /// </summary> private void LoadInfoProductGroup() { try { //string sLink =Form_Main.URL_API + "/api/IPC247/sp_extension_GetDataByStore?sql_Exec=" + "sp_ProductGroup_Getdata"; //var json = API.API_GET(sLink); //var jsondata = JObject.Parse(json).GetValue("Data"); //DataTable dt = (DataTable)JsonConvert.DeserializeObject(jsondata.ToString(), (typeof(DataTable))); DataTable dt = SQLHelper.ExecuteDataTable("sp_ProductGroup_Getdata"); // listHeader = JsonConvert.DeserializeObject<List<ProductGroupHeader>>(jsondata.ToString()); listHeader = new List <ProductGroupHeader>(); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string _ID = dt.Rows[i]["ID"].ToString(); string _ProductGroupName = dt.Rows[i]["ProductGroupName"].ToString(); string _ListProductCode = dt.Rows[i]["ListProductCode"].ToString(); string _CreateBy = dt.Rows[i]["CreateBy"].ToString(); string _CreateDate = dt.Rows[i]["CreateDate"].ToString(); string _UpdateBy = dt.Rows[i]["UpdateBy"].ToString(); string _UpdateDate = dt.Rows[i]["UpdateDate"].ToString(); decimal _TongTien = decimal.Parse(dt.Rows[i]["TongTien"].ToString()); ProductGroupHeader ob = new ProductGroupHeader(_ID, _ProductGroupName, _ListProductCode, _CreateBy, _CreateDate, _UpdateBy, _UpdateDate, _TongTien); listHeader.Add(ob); } } dgc_Main.DataSource = listHeader; if (listHeader == null || listHeader.Count == 0) { listdetails = new List <ProductGroupDetails>(); dgcDetails.DataSource = listdetails; dgvDetails.RefreshData(); } dgv_Main.BestFitColumns(true); } catch (Exception ex) { API.API_ERRORLOG(new ERRORLOG(Form_Main.IPAddress, "Form_ProductGroup", "LoadInfoProductGroup()", ex.ToString())); } }
private void TaoMoi() { IDGroup = "0"; ProductGroupHeader ob = new ProductGroupHeader(); ob.ProductGroupName = txtTenNhom.Text; ob.CreateBy = Form_Main.user.Username; listHeader.Add(ob); dgc_Main.DataSource = listHeader; dgv_Main.RefreshData(); dgv_Main.BestFitColumns(true); ProductGroupDetails obd = new ProductGroupDetails(); listdetails = new List <ProductGroupDetails>(); obd.SoLuong = 1; listdetails.Add(obd); dgcDetails.DataSource = listdetails; dgvDetails.RefreshData(); dgvDetails.BestFitColumns(true); }
private void tạoBảnSaoToolStripMenuItem_Click(object sender, EventArgs e) { int focus = dgv_Main.FocusedRowHandle; if (focus >= 0) { ProductGroupHeader ob = (ProductGroupHeader)dgv_Main.GetFocusedRow(); if (ob != null) { ProductGroupHeader ob1 = new ProductGroupHeader(ob); ob1.ID = "0"; ob1.ProductGroupName = ob1.ProductGroupName + "-(Copy)"; ob1.CreateBy = Form_Main.user.Username; ob1.CreateDate = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); ob1.UpdateBy = ""; ob.CreateDate = ""; listHeader.Add(ob1); dgv_Main.RefreshData(); } } }