public IHttpActionResult PostNhapKho(NhapKho nhapKho) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.nhapKhos.Add(nhapKho); try { db.SaveChanges(); } catch (DbUpdateException) { if (NhapKhoExists(nhapKho.IDNK)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nhapKho.IDNK }, nhapKho)); }
private void adddlnk() { DataTable dt = new DataTable(); dt = NhapKho.Get_nhapkho(); if (dt != null) { dgv_nhapkho.DataSource = dt; dgv_nhapkho.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; for (int i = 0; i < dgv_nhapkho.Columns.Count; i++) { dgv_nhapkho.Columns[i].ReadOnly = true; } dgv_nhapkho.Columns[0].HeaderText = "Mã"; dgv_nhapkho.Columns[0].Width = 65; dgv_nhapkho.Columns[1].HeaderText = "Ngày Nhập"; dgv_nhapkho.Columns[1].Width = 100; dgv_nhapkho.Columns[2].HeaderText = "Tổng Tiền"; dgv_nhapkho.Columns[2].Width = 120; dgv_nhapkho.Columns[3].HeaderText = "Nhân viên"; dgv_nhapkho.Columns[3].Width = 85; for (int i = 0; i < 4; i++) { dgv_nhapkho.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } } }
public IHttpActionResult PutNhapKho(string id, NhapKho nhapKho) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nhapKho.IDNK) { return(BadRequest()); } db.Entry(nhapKho).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NhapKhoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void btncliclk(object sender, EventArgs e) { NhapKho nk = new NhapKho(); nk.Ma = txt_ma.Text; nk.NgayNhap = time_ngaynhap.Value; // if (txt_money.Text != "") // nk.Tongtien = decimal.Parse(txt_money.Text); // else nk.Tongtien = 0; if (cbb_nvma.Text != "") { nk.NhanVienMa = cbb_nvma.Text; } else { nk.NhanVienMa = "notDL"; } if (change == false) { nk.them(); } else { nk.sua(); } btn_luu.Actived = false; if (saveclick != null) { saveclick(); txt_ma.Text = layma(); } }
public bool UpdateNhapKho(NhapKho obj) { try { string idLog = Guid.NewGuid().ToString(); DAL.ConnectData.getInstance().UpdateCommand(tableNhapKho, "id", SqlDbType.NVarChar, obj.Id, "name", SqlDbType.NVarChar, obj.Name, "birth_day", SqlDbType.NVarChar, obj.Birthday, "stt", SqlDbType.NVarChar, obj.Stt, "description", SqlDbType.NVarChar, obj.Description, "id_ticket_hospital", SqlDbType.NVarChar, obj.Tickethospital.ToLower().Trim(), "id_luu_tru", SqlDbType.NVarChar, obj.Luutru.ToLower().Trim(), "id_kho", SqlDbType.UniqueIdentifier, new Guid(obj.Kho), "update_date", SqlDbType.DateTime, obj.Updatedate, "update_by", SqlDbType.NVarChar, obj.Updateby, "id_nhapkho_log", SqlDbType.UniqueIdentifier, new Guid(idLog), "is_used", SqlDbType.Int, 1); //Lưu log DAL.ConnectData.getInstance().InsertCommand(tableNhapKhoLog, "id", SqlDbType.UniqueIdentifier, new Guid(idLog), "id_hdn", SqlDbType.UniqueIdentifier, new Guid(obj.Id), "description", SqlDbType.NVarChar, obj.Description, "create_date", SqlDbType.DateTime, obj.Createdate, "create_by", SqlDbType.NVarChar, obj.Createby, "id_kho", SqlDbType.UniqueIdentifier, new Guid(obj.Kho), "soct", SqlDbType.NVarChar, obj.Soct); } catch (Exception ex) { return(false); } return(true); }
public override global::System.Data.DataSet Clone() { NhapKho cln = ((NhapKho)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public void HienNhapKho(List <NhapKho> list) { Console.WriteLine("|{0,-20}|{1,-20}|{2,-20}|{3,-20}|{4,-20}|", "Mã báo cáo", "Ngày nhập", "Tên mặt hàng", "Số lượng", "Giá bán"); foreach (NhapKho NhapKho in list) { NhapKho.Display(); } }
public ActionResult DeleteConfirmed(string id) { NhapKho nhapKho = db.NhapKhos.Find(id); db.NhapKhos.Remove(nhapKho); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ResponseData> LayTatCaPhieuNhapKho() { try { string url = string.Format("{0}/api/import/get-all", Config.HOST); var client = new RestSharp.RestClient(url); var request = new RestSharp.RestRequest(Method.GET); request.AddHeader("content-type", "application/json; charset=utf-8"); request.AddHeader("x-access-token", UserResponse.AccessToken); var response = await client.ExecuteTaskAsync(request); var responseParse = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(response.Content); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var data = responseParse["data"]; var listPhieuNhapJson = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(data.ToString()); List <NhapKho> listNhapKho = new List <NhapKho>(); foreach (var item in listPhieuNhapJson) { NhapKho nhapKho = Newtonsoft.Json.JsonConvert.DeserializeObject <NhapKho>(item.ToString()); Kho kho = new Kho() { Id = item["IdKho"], Ten = item["TenKho"] }; NhanVien nhanVien = new NhanVien() { Id = item["IdNhanVien"], Ten = item["TenNhanVien"] }; NhaCungCap nhaCungCap = new NhaCungCap() { Id = item["IdNhaCungCap"], Ten = item["TenNhaCungCap"] }; nhapKho.NhanVien = nhanVien; nhapKho.Kho = kho; nhapKho.NhaCungCap = nhaCungCap; listNhapKho.Add(nhapKho); } return(new ResponseData() { Status = Config.CODE_OK, Data = listNhapKho, Message = "" }); } else { return(Util.GenerateErrorResponse(response, responseParse)); } } catch (Exception ex) { return(null); } }
public ActionResult Edit([Bind(Include = "STT,MaPhieuNhap,MaHangHoa,SoLuong,NgayNhap,MaNCCS")] NhapKho nhapKho) { if (ModelState.IsValid) { db.Entry(nhapKho).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhapKho)); }
public ActionResult Edit([Bind(Include = "MaNhapKho,NgayNhap,MoTa")] NhapKho nhapKho) { if (ModelState.IsValid) { db.Entry(nhapKho).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhapKho)); }
public changenk(NhapKho nk) { InitializeComponent(); txt_ma.Text = nk.Ma.ToString(); time_ngaynhap.Value = nk.NgayNhap; cbb_nvma.Text = nk.NhanVienMa; // txt_money.Text = nk.Tongtien.ToString(); cbb_nvma.Enabled = false; lbl_chedo.Text = "Sửa"; cbb_nvma.Text = nk.NhanVienMa; }
public ActionResult Create([Bind(Include = "STT,MaPhieuNhap,MaHangHoa,SoLuong,NgayNhap,MaNCCS")] NhapKho nhapKho) { if (ModelState.IsValid) { db.NhapKhos.Add(nhapKho); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhapKho)); }
public IHttpActionResult GetNhapKho(string id) { NhapKho nhapKho = db.nhapKhos.Find(id); if (nhapKho == null) { return(NotFound()); } return(Ok(nhapKho)); }
public ActionResult Create([Bind(Include = "MaNhapKho,NgayNhap,MoTa")] NhapKho nhapKho) { if (ModelState.IsValid) { db.NhapKhoes.Add(nhapKho); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nhapKho)); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { NhapKho ds = new NhapKho(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public ActionResult Edit([Bind(Include = "Id,NguoiNhap,NgayNhap,IdQuanLiKho,SoLuong")] NhapKho nhapKho) { if (ModelState.IsValid) { db.Entry(nhapKho).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdQuanLiKho = new SelectList(db.QuanLiKhoes, "Id", "Id", nhapKho.IdQuanLiKho); ViewBag.NguoiNhap = new SelectList(db.QuanTris, "Id", "HoVaTen", nhapKho.NguoiNhap); return(View(nhapKho)); }
public void Sua(List <NhapKho> list) { NhapKho NhapKho = TimNhapKho(list); if (NhapKho == null) { Console.WriteLine("Không tìm thấy báo cáo"); } else { NhapKho.Nhap(list); } }
public void TimKiem(List <NhapKho> list) { NhapKho NhapKho = TimNhapKho(list); if (NhapKho == null) { Console.WriteLine("Không tìm thấy báo cáo"); } else { NhapKho.Display(); } }
public void Xoa(List <NhapKho> list) { NhapKho NhapKho = TimNhapKho(list); if (NhapKho == null) { Console.WriteLine("Không tìm thấy báo cáo"); } else { list.Remove(NhapKho); } }
private string layma() { DataTable dt = new DataTable(); string check; do { Random rd = new Random(); int temp = rd.Next(99999999); check = "NK" + temp.ToString(); dt = NhapKho.checkmanhapkho(check); } while (dt == null); return(check); }
public IHttpActionResult DeleteNhapKho(string id) { NhapKho nhapKho = db.nhapKhos.Find(id); if (nhapKho == null) { return(NotFound()); } db.nhapKhos.Remove(nhapKho); db.SaveChanges(); return(Ok(nhapKho)); }
// GET: NhapKhos/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NhapKho nhapKho = db.NhapKhos.Find(id); if (nhapKho == null) { return(HttpNotFound()); } return(View(nhapKho)); }
private void dgv_nhapkho_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { var result = MessageBox.Show("Bạn thật sự muốn xóa", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { NhapKho.xoa_nhapkho(dgv_nhapkho.CurrentRow.Cells[0].Value.ToString()); adddlnk(); } } }
private void dgv_nhapkho_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { if (dgv_nhapkho.Rows[e.RowIndex].Cells[0].Value != null && dgv_nhapkho.Rows[e.RowIndex].Cells[0].Value.ToString() != "") { NhapKho nk = new NhapKho(); nk = adddl(); changenk cnk = new changenk(nk); cnk.change = true; cnk.ShowDialog(); } rowindex = e.RowIndex; } }
public void NhapNhapKho(List <NhapKho> list) { while (true) { NhapKho NhapKho = new NhapKho(); NhapKho.Nhap(list); list.Add(NhapKho); Console.WriteLine("Bạn muốn nhập tiếp không?C/K"); string chon = Console.ReadLine(); if (chon == "k" || chon == "K") { break; } } }
private NhapKho TimNhapKho(List <NhapKho> list) { NhapKho NhapKho = null; Console.WriteLine("Nhập từ khóa: "); string tukhoa = Console.ReadLine(); foreach (NhapKho sp in list) { if (tukhoa.Equals(sp.Mabaocao) || tukhoa.Equals(sp.Tenmathang)) { NhapKho = sp; } } return(NhapKho); }
private NhapKho adddl() { NhapKho nk = new NhapKho(); nk.Ma = dgv_nhapkho.CurrentRow.Cells[0].Value.ToString(); nk.NgayNhap = DateTime.Parse(dgv_nhapkho.CurrentRow.Cells[1].Value.ToString()); if (dgv_nhapkho.CurrentRow.Cells[2].Value.ToString() != "") { nk.Tongtien = decimal.Parse(dgv_nhapkho.CurrentRow.Cells[2].Value.ToString()); } if (dgv_nhapkho.CurrentRow.Cells[3].Value.ToString() != "") { nk.NhanVienMa = dgv_nhapkho.CurrentRow.Cells[3].Value.ToString(); } return(nk); }
public void ThongKeNhap(List <NhapKho> list) { int dem = 0; NhapKho nhapKho = TimNhapKho(list); if (nhapKho == null) { Console.WriteLine("Không tìm thấy báo cáo"); } else { dem += nhapKho.Soluong; nhapKho.Display(); } Console.WriteLine("Số lượng xuất là: " + dem); }
// GET: admin/NhapKhoes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NhapKho nhapKho = db.NhapKhoes.Find(id); if (nhapKho == null) { return(HttpNotFound()); } ViewBag.IdQuanLiKho = new SelectList(db.QuanLiKhoes, "Id", "Id", nhapKho.IdQuanLiKho); ViewBag.NguoiNhap = new SelectList(db.QuanTris, "Id", "HoVaTen", nhapKho.NguoiNhap); return(View(nhapKho)); }