public bool Insert() { bool flag = false; using (PersistentManager persistentManager = new PersistentManager()) { SupplierDao dao = new SupplierDao(); string sql = string.Format("Insert into BI_SUPPLIER (SUPPLIERCODE,SUPPLIERNAME,TEL,FAX,CONTECTPERSON,ADDRESS,ZIP,BANKACCOUNT,BANKNAME,TAXNO,CREDITGRADE,ISACTIVE,MEMO) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')" , this.SUPPLIERCODE, this.SUPPLIERNAME, this.TEL, this.FAX, this.CONTECTPERSON, this.ADDRESS, this.ZIP, this.BANKACCOUNT, this.BANKNAME, this.TAXNO, this.CREDITGRADE, this.ISACTIVE, this.MEMO); dao.SetData(sql); flag = true; } return(flag); }
public ActionResult Create(Supplier collection) { try { SetViewBag(collection.CityID); SetViewBagDistrict(collection.DistrictID, collection.CityID); if (ModelState.IsValid) { // TODO: Add insert logic here SupplierDao bdDao = new SupplierDao(); UserLogin us = (UserLogin)Session[CommonConstant.USER_SESSION]; collection.SupplierID = bdDao.GenaraCode("CU", 4); collection.CreateDate = Hepper.GetDateServer(); collection.ModifiedDate = Hepper.GetDateServer(); collection.CreateBy = us.UserName; collection.ModifiedBy = us.UserName; if (bdDao.Insert(collection) > 0) { SetAlert("Thêm thành công", "success"); return(RedirectToAction("Index")); } else { SetAlert("Không thêm được", "danger"); } } return(View()); } catch { SetAlert("Không thêm được", "danger"); return(View()); } }
public bool Update() { bool flag = false; using (PersistentManager persistentManager = new PersistentManager()) { SupplierDao dao = new SupplierDao(); string sql = string.Format("update BI_SUPPLIER set SUPPLIERNAME='{1}',TEL='{2}',FAX='{3}',CONTECTPERSON='{4}',ADDRESS='{5}',ZIP='{6}',BANKACCOUNT='{7}',BANKNAME='{8}',TAXNO='{9}',CREDITGRADE='{10}',ISACTIVE='{11}',MEMO='{12}' where SUPPLIERCODE='{0}'" , this.SUPPLIERCODE, this.SUPPLIERNAME, this.TEL, this.FAX, this.CONTECTPERSON, this.ADDRESS, this.ZIP, this.BANKACCOUNT, this.BANKNAME, this.TAXNO, this.CREDITGRADE, this.ISACTIVE, this.MEMO); dao.SetData(sql); flag = true; } return(flag); }
private void Insert() { try { if (supplier == null) { supplier = new Supplier(); GetFormSupplier(); if (SupplierDao.Insert(_ConfigItem, supplier) != 0) { AssignTagValueOnDXControl(this); ShowMessageBox("FORMMAIN_001"); this.Close(); } else { ShowMessageBox("FORMMAIN_002"); } } else { GetFormSupplier(); if (SupplierDao.Update(_ConfigItem, supplier)) { AssignTagValueOnDXControl(this); ShowMessageBox("FRMADDSUPPLIER_I_001", COREBASE.COMMAND.MessageUtils.MessageType.INFORM); this.Close(); } } } catch (Exception ex) { AppError("frmAddSupplier:Insert():" + ex); } }
private bool Update(DataRow row) { try { object[] arrParaValue = new object[] { row["Id"], row["Name"], row["Phone"], row["Address"], row["Fax"], row["Email"], row["Website"], _ConfigItem.Login_UserName, row["TaxCode"], row["Credit"], row["Debit"], }; SupplierDao.Update(_ConfigItem, arrParaValue); return(true); } catch (Exception ex) { AppDebug(ex); return(false); } }
private void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e) { try { DataTable Tmp = (DataTable)(gvSupplier.DataSource); for (int i = 0; i < Tmp.Rows.Count; i++) { DataRow dr = Tmp.Rows[i]; if (isModifedRow(dr)) { Update(dr); } if (isNewRow(dr)) { Insert(dr); } if (isDeletedRow(dr)) { SupplierDao.Delete(_ConfigItem, (int)GetOriginalItemData(dr, "Id")); } } BidingGrid(); } catch (Exception ex) { AppDebug(ex); } }
public static string GetSupplierName(int SupplierId) { SupplierDao SupplierDao = new SupplierDao(); string supplierName = SupplierDao.GetSupplierName(SupplierId); return(supplierName); }
private void gridView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData.Equals(System.Windows.Forms.Keys.Delete)) { try { int[] _IndexRowSelected = gridView1.GetSelectedRows(); int _CurIndexRow = _IndexRowSelected[0]; DataTable tmp = (DataTable)gvSupplier.DataSource; object[] obj = new object[1]; obj[0] = tmp.Rows[_CurIndexRow]["Name"]; if (ShowMessageBox("FRMADDSUPPLIER_C_002", COREBASE.COMMAND.MessageUtils.MessageType.CONFIRM, obj) == System.Windows.Forms.DialogResult.Yes) { SupplierDao.Delete(_ConfigItem, CnvToInt32(tmp.Rows[_CurIndexRow]["Id"])); BidingGrid(); } } catch (Exception ex) { //TODO: Ghi log tai day nhe throw ex; } } }
public string GetNewSupplierCode() { using (PersistentManager persistentManager = new PersistentManager()) { SupplierDao dao = new SupplierDao(); return(dao.GetNewSupplierCode()); } }
public DataSet QuerySupplier(int pageIndex, int pageSize, string filter, string OrderByFields) { using (PersistentManager persistentManager = new PersistentManager()) { SupplierDao dao = new SupplierDao(); return(dao.Query(strTableView, strPrimaryKey, strQueryFields, pageIndex, pageSize, OrderByFields, filter, strTableView)); } }
public int GetRowCount(string filter) { using (PersistentManager persistentManager = new PersistentManager()) { SupplierDao dao = new SupplierDao(); return(dao.GetRowCount(strTableView, filter)); } }
// GET: admin/nhacungcap public ActionResult index(string search, int page = 1, int pageSize = 5) { var dao = new SupplierDao(); //Tạo page sử dụng Pagedlist var model = dao.ListAllPaging(search, page, pageSize); ViewBag.Search = search; return(View(model)); }
// GET: Supplier/Edit/5 public ActionResult Edit(long id) { SupplierDao bdDao = new SupplierDao(); var sp = bdDao.FindByID(id); SetViewBag(sp.CityID); SetViewBagDistrict(sp.DistrictID, sp.CityID); return(View(sp)); }
public JsonResult DeleteSupplier(int id) { var dao = new SupplierDao(); bool temp = dao.Delete(id); return(Json(new { status = temp })); }
public JsonResult ChangeSupeelier(string cityid) { var dao = new SupplierDao(); var list = dao.FindByCity(cityid); JsonResult result = new JsonResult(); result.Data = list; result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(result); }
public ActionResult Index() { Dictionary <string, List <Item> > items = ItemDao.getItemsForRequisition(); List <Supplier> suppliers = SupplierDao.GetSuppliers(); ViewData["Items"] = items; ViewData["Suppliers"] = suppliers; return(View("OrderItems")); }
public JsonResult GetDetail(int id) { var dao = new SupplierDao(); var supplier = dao.FindID(id); return(Json(new { data = supplier, status = true }, JsonRequestBehavior.AllowGet)); }
public void SetSupplierBag(long?selectedId = 0) { var dao = new SupplierDao(); var lst = dao.ToList(); //Category objCate = new Category(); //objCate.CategoryID = 0; //objCate.Name = "Chọn hết"; //lst.Add(objCate); ViewBag.Suppliercate = new SelectList(lst, "ID", "SupplierName", selectedId); }
public bool Delete(DataSet dataSet) { bool flag = false; using (PersistentManager persistentManager = new PersistentManager()) { SupplierDao dao = new SupplierDao(); dao.DeleteEntity(dataSet); flag = true; } return(flag); }
public JsonResult LoadData(string name, int page, int pageSize) { var dao = new SupplierDao(); var model = dao.ListAllPage(name, page, pageSize); int totalRow = dao.Count(name); return(Json(new { data = model, total = totalRow, status = true }, JsonRequestBehavior.AllowGet)); }
public ActionResult GenerateOrderReport() { List <Supplier> suppliers = SupplierDao.GetSuppliers(); Dictionary <int, string> monthDict = new Dictionary <int, string>(); foreach (var i in Enum.GetValues(typeof(Months))) { monthDict.Add((int)i, i.ToString()); } ViewData["Suppliers"] = suppliers; ViewData["MonthDict"] = monthDict; return(View("OrderReport")); }
public void SetViewSupplier(long?selectedId = null, string cityid = null, string districtid = null) { var dao = new SupplierDao(); if (cityid != null) { ViewBag.Supplier = new SelectList(dao.FindByDistrist(cityid, districtid), "ID", "SupplierName", selectedId); } else { ViewBag.Supplier = new SelectList(dao.ToList(), "ID", "SupplierName", selectedId); } }
public static bool DeleteSupplier(int supplierId) { //ManagerHelper.CheckPrivilege(Privilege.DeleteProductType); bool flag = new SupplierDao().DeleteSupplier(supplierId); if (flag) { EventLogs.WriteOperationLog(Privilege.SupplierDelete, string.Format(CultureInfo.InvariantCulture, "删除了编号为”{0}”的供货商", new object[] { supplierId })); } return(flag); }
public ActionResult Delete(long id) { try { // TODO: Add delete logic here SupplierDao bdDao = new SupplierDao(); bdDao.Delete(id); // SetAlert("Xóa thành công", "success"); return(RedirectToAction("Index")); } catch { // SetAlert("Không xóa được", "danger"); return(View()); } }
public FrmSupplier(Guid?ID = null) { InitializeComponent(); if (ID != null) { getID = Guid.Parse(ID.ToString()); DataTable dt = SupplierDao.GetSupplierById(getID); if (dt != null) { txtName.Text = dt.Rows[0]["Name"].ToString(); txtPhone.Text = dt.Rows[0]["Phone"].ToString(); txtDescritp.Text = dt.Rows[0]["Descript"].ToString(); pic = SupplierDao.GetPhoto(getID); if (pic != null) { picSupplier.Image = Helpers.ByteArrayToImage(pic); } } } }
public JsonResult SaveData(Supplier supplier) { var dao = new SupplierDao(); bool temp = false; //Save //Add category if (supplier.IDSupplier == 0) { dao.Insert(supplier); temp = true; } else { dao.Edit(supplier); temp = true; } return(Json(new { status = temp })); }
private void FrmListAllSupplier_Load(object sender, EventArgs e) { dgvSupplier.DataSource = SupplierDao.ListAllSupplier(); dgvSupplier.ColumnHeadersDefaultCellStyle.Font = new Font("Time News Roman", 14, FontStyle.Bold); dgvSupplier.DefaultCellStyle.Font = new Font("Khmer OS System", 12); dgvSupplier.Columns["ID"].Width = 0; dgvSupplier.Columns["Name"].Width = 150;//define column width dgvSupplier.Columns["Phone"].Width = 150; dgvSupplier.Columns["Descript"].Width = 100; //define image size stretch DataGridViewImageColumn img = new DataGridViewImageColumn(); img = (DataGridViewImageColumn)dgvSupplier.Columns["Photo"]; img.ImageLayout = DataGridViewImageCellLayout.Zoom; foreach (DataGridViewColumn col in dgvSupplier.Columns) { col.SortMode = DataGridViewColumnSortMode.NotSortable; } dgvSupplier.ClearSelection(); //clear select item in datagridview }
private void Insert(DataRow row) { try { object[] arrParaValue = new object[] { row["Name"], row["Phone"], row["Address"], row["Fax"], row["Email"], row["Website"], _ConfigItem.Login_UserName, row["TaxCode"], row["Credit"], row["Debit"], }; SupplierDao.Insert(_ConfigItem, arrParaValue); } catch (Exception ex) { AppDebug(ex); } }
// GET: Supplier/Details/5 public ActionResult Details(long id) { SupplierDao bdDao = new SupplierDao(); var sl = bdDao.FindByID(id); if (sl.Status == true) { ViewBag.Status = "Kích hoạt"; } else { ViewBag.Status = "Khóa"; } var dao = new CityDao(); var ct = dao.FindByID(sl.CityID); ViewBag.CityName = ct[0].Name; var disDao = new DistrictDao(); var dist = disDao.FindByID(sl.CityID, sl.DistrictID); ViewBag.DistName = dist.Name; return(View(sl)); }
private void Save() { if (string.IsNullOrWhiteSpace(txtName.Text) || string.IsNullOrWhiteSpace(txtDescritp.Text) || string.IsNullOrWhiteSpace(txtPhone.Text) || picSupplier.Image == null) { MessageBox.Show("Please input some data!!"); return; } SupplierEntity supplierEntity = new SupplierEntity(); supplierEntity.Name = txtName.Text; supplierEntity.Phone = txtPhone.Text; supplierEntity.Descritp = txtDescritp.Text; supplierEntity.Photo = pic; if (getID != Guid.Empty) { supplierEntity.ID = getID; SupplierDao.Update(supplierEntity); } else { supplierEntity.ID = Guid.NewGuid(); SupplierDao.Insert(supplierEntity); } }