public void Delete(Garment garment) { using (DbManager db = new DbManager()) { Accessor.Query.Delete(db, garment); } }
protected void gvGarmentList_SelectedIndexChanged(object sender, EventArgs e) { chkBrandsUpdate.Items.Clear(); LoadAllBrands(); garment = GM.GetGarmentByKey(long.Parse(gvGarmentList.SelectedRow.Cells[2].Text)); fGarment_update.GarmentCode = garment.GarmentCode; fGarment_update.GarmentDescription = garment.GarmentDescription; if (garment.TopOrBottom == 'T') { fGarment_update.TopOrBottom = "T"; } else { fGarment_update.TopOrBottom = "B"; } var brand_garments = from bg in BrandGarmentMan.BrandGarments() where bg.GarmentCode == fGarment_update.GarmentCode select bg; foreach (BrandGarment bg in brand_garments) { for (int i = 0; i < this.chkBrandsUpdate.Items.Count; i++) { if (chkBrandsUpdate.Items[i].Value == bg.BrandCode) { chkBrandsUpdate.Items[i].Selected = true; } } } updateErrorMessage.Visible = false; lblGarmentToDelete.Text ="Delete garment " + garment.GarmentDescription +"?"; }
protected void btnSaveUpdate_Click(object sender, EventArgs e) { garment = GM.GetGarmentByKey(long.Parse(gvGarmentList.SelectedRow.Cells[2].Text)); garment.GarmentCode = txtGarmentCodeUpdate.Text.ToUpper(); garment.GarmentDescription = txtGarmentDescriptionUpdate.Text.ToUpper(); garment.TopOrBottom = char.Parse(rdioTopOrBottomUpdate.SelectedValue); GM.Save(garment); LoadAllGarments(); }
protected void btnSaveUpdate_Click(object sender, EventArgs e) { garment = GM.GetGarmentByKey(long.Parse(gvGarmentList.SelectedRow.Cells[2].Text)); garment.GarmentCode = fGarment_update.GarmentCode.ToUpper(); garment.GarmentDescription = fGarment_update.GarmentDescription.ToUpper(); garment.TopOrBottom = char.Parse(fGarment_update.TopOrBottom); GM.Save(garment); UpdateBrandGarments(); LoadAllGarments(); }
public void Save(Garment garment) { using (DbManager db = new DbManager()) { if (garment.RecordNo != 0) { Accessor.Query.Update(db, garment); } else { Accessor.Query.Insert(db, garment); } } }
protected void gvGarmentList_SelectedIndexChanged(object sender, EventArgs e) { garment = GM.GetGarmentByKey(long.Parse(gvGarmentList.SelectedRow.Cells[2].Text)); txtGarmentCodeUpdate.Text = garment.GarmentCode; txtGarmentDescriptionUpdate.Text = garment.GarmentDescription; if (garment.TopOrBottom == 'T') { rdioTopOrBottomUpdate.SelectedIndex = 0; } else { rdioTopOrBottomUpdate.SelectedIndex = 1; } }
protected void btnSaveGarment_Click(object sender, EventArgs e) { var garment = new Garment{ GarmentCode = txtGarmentCode.Text.ToUpper(), GarmentDescription = txtGarmentDescription.Text.ToUpper(), TopOrBottom = char.Parse(rdioTopOrBottom.SelectedValue), IsActive ="Yes", DateCreated = DateTimeOffset.Now }; GM.Save(garment); txtGarmentCode.Text = null; txtGarmentDescription.Text = null; LoadAllGarments(); }
protected void btnSaveGarment_Click(object sender, EventArgs e) { var garment = new Garment{ GarmentCode = fGarment.Garment.GarmentCode.ToUpper(), GarmentDescription = fGarment.Garment.GarmentDescription.ToUpper(), TopOrBottom = fGarment.Garment.TopOrBottom, IsActive = fGarment.Garment.IsActive, DateCreated = fGarment.Garment.DateCreated }; GM.Save(garment); SaveBrandGarments(); fGarment.GarmentCode = null; fGarment.GarmentDescription = null; fGarment.TopOrBottom = null; LoadAllGarments(); }
protected void btnYes_Click(object sender, EventArgs e) { garment = GM.GetGarmentByKey(long.Parse(gvGarmentList.SelectedRow.Cells[2].Text)); GM.Delete(garment); LoadAllGarments(); }