protected void btn_edit_Click(object sender, EventArgs e) { DealDTO DO = new DealDTO(); DO.ID_TYPE = input_Type.Text; DO.ID_AGENCY = input_Agency.Text; DO.QUANTITY_RECEIVE = input_QuantityReceive.Text; DO.QUANTITY_SELL = input_QuantitySell.Text; string[] d = input_DateReceive.Text.Split('/'); string date = d[1] + "-" + d[0] + "-" + d[2]; DO.DATE_RECEIVE = date; DO.COMMISSION = input_Commission.Text; if (DBL.Edit(DO) == true) { MessageBox("Sửa thành công", "Deal.aspx"); } else { MessageBox("Sửa không thành công", "Deal.aspx"); } }
protected void function_insert_Click(object sender, EventArgs e) { DealDTO DO = new DealDTO(); DO.ID_TYPE = ddlType.Text; DO.ID_AGENCY = ddlAgency.Text; DO.QUANTITY_RECEIVE = input_QuantityReceive.Text; DO.QUANTITY_SELL = input_QuantitySell.Text; string[] d = input_DateReceive.Text.Split('/'); string date = d[1] + "-" + d[0] + "-" + d[2]; DO.DATE_RECEIVE = date; DO.COMMISSION = "10"; if (input_QuantityReceive.Text != "") { if (DBL.Insert(DO) == true) { MessageBox("Thêm thành công", "Deal.aspx"); uploadData(); } else { MessageBox("Lỗi hệ thống", "Deal.aspx"); uploadData(); } } else { MessageBox("Lỗi dữ liệu vào, xem lại lỗi ở khung dưới thêm!!!", "Deal.aspx"); } }
private async Task <List <DealDTO> > CheckConsumerIsInRange() { List <DealDTO> ConsumerDeals = new List <DealDTO>(); var consumerBuffer = await GenerateGeoBufferQuery.GenerateBuffer(UserFilters.Range * 1000, UserFilters.Location); var queryBody = GeoFenceHelper.CreateRangeCheckJsonBody(consumerBuffer); foreach (FilterDeal filterDeal in _filteredDeals) { var val = GeoFenceHelper.FindRange(queryBody, filterDeal); if (val == 0) { continue; } Deal temp = _deals.First(d => d.Id.Equals(filterDeal.DealId)); DealDTO deal = new DealDTO { DealTitle = temp.Title, DealDescription = temp.Description, BusinessName = temp.Business.Name, Latitude = temp.Business.Location.Latitude, Longitude = temp.Business.Location.Longitude }; ConsumerDeals.Add(deal); } return(ConsumerDeals); }
public bool Delete(DealDTO TOP) { try { D_DAL.Delete(TOP); } catch (Exception ex) { return(false); } return(true); }
public bool Edit(DealDTO DO) { try { D_DAL.Edit(DO); } catch (Exception ex) { return(false); } return(true); }
protected void btn_delete_Click(object sender, EventArgs e) { DealDTO TOP = new DealDTO(); TOP.ID_TYPE = id_delete1; TOP.ID_AGENCY = id_delete2; TOP.DATE_RECEIVE = id_delete3; if (DBL.Delete(TOP) == true) { MessageBox("Xóa thành công", "Deal.aspx"); } else { MessageBox("Xóa không thành công", "Deal.aspx"); } }
public DataTable Find_mul_deal(DealDTO TOP) { ConnectDB.con.Open(); SqlCommand cmd = new SqlCommand("find_MUL_DEAL", ConnectDB.con); cmd.Connection = ConnectDB.con; cmd.Parameters.Add("@ID_TYPE", SqlDbType.VarChar).Value = TOP.ID_TYPE; cmd.Parameters.Add("@ID_AGENCY", SqlDbType.VarChar).Value = TOP.ID_AGENCY; cmd.Parameters.Add("@DATE", SqlDbType.VarChar).Value = TOP.DATE_RECEIVE; cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable tb = new DataTable(); sda.Fill(tb); ConnectDB.con.Close(); return(tb); }
public void loadDataFind() { DealDTO DO = new DealDTO(); DO.ID_TYPE = id_edit1; DO.ID_AGENCY = id_edit2; DO.DATE_RECEIVE = id_edit3; DataTable tb = DBL.Find_mul_deal(DO); input_Type.Text = tb.Rows[0][0].ToString(); input_Agency.Text = tb.Rows[0][1].ToString(); input_QuantityReceive.Text = tb.Rows[0][2].ToString(); input_QuantitySell.Text = tb.Rows[0][3].ToString(); string[] date = tb.Rows[0][4].ToString().Split(' '); input_DateReceive.Text = date[0]; input_Commission.Text = tb.Rows[0][5].ToString(); }
public void Delete(DealDTO TOP) { ConnectDB.con.Open(); try { SqlCommand cmd = new SqlCommand("delete_DEAL", ConnectDB.con); cmd.Parameters.Add("@ID_TYPE", SqlDbType.VarChar).Value = TOP.ID_TYPE; cmd.Parameters.Add("@ID_AGENCY", SqlDbType.VarChar).Value = TOP.ID_AGENCY; cmd.Parameters.Add("@DATE_RECEIVE", SqlDbType.VarChar).Value = TOP.DATE_RECEIVE; cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } catch { throw; } finally { ConnectDB.con.Close(); } }
public void Edit(DealDTO TOP) { ConnectDB.con.Open(); try { SqlCommand cmd = new SqlCommand("edit_DEAL", ConnectDB.con); cmd.Parameters.Add("@ID_TYPE", SqlDbType.VarChar).Value = TOP.ID_TYPE; cmd.Parameters.Add("@ID_AGENCY", SqlDbType.VarChar).Value = TOP.ID_AGENCY; cmd.Parameters.Add("@QUANTITY_RECEIVE", SqlDbType.Int).Value = TOP.QUANTITY_RECEIVE; cmd.Parameters.Add("@QUANTITY_SELL", SqlDbType.Int).Value = TOP.QUANTITY_SELL; cmd.Parameters.Add("@DATE_RECEIVE", SqlDbType.VarChar).Value = TOP.DATE_RECEIVE; cmd.Parameters.Add("@COMMISSION", SqlDbType.Float).Value = TOP.COMMISSION; cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } catch { throw; } finally { ConnectDB.con.Close(); } }
public DataTable Find_mul_deal(DealDTO TOP) { return(D_DAL.Find_mul_deal(TOP)); }