private void btnDelete_Click(object sender, EventArgs e) { CItemType oitemtype = Getformdata(); CItemBO oitembo = new CItemBO(); CResult oresult = new CResult(); if (validatedata()) { if ((MessageBox.Show("Do u really want to delete this item. ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) == DialogResult.Yes) { oresult = oitembo.Delete(oitemtype); } if (oresult.IsSuccess == true) { if (oresult.Data.ToString() == "0") { MessageBox.Show("Deletion Not Possible", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadItemType(); Clearformdata(); } else { MessageBox.Show("Deleted Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadItemType(); Clearformdata(); } } else { MessageBox.Show("Error" + oresult.ErrMsg + ""); } } }
private void btnSave_Click(object sender, EventArgs e) { CItemType oitemtype = Getformdata(); CItemBO oitembo = new CItemBO(); CResult oresult = new CResult(); if (validatedata()) { if (txttypeid.Text.Trim() != string.Empty) { if (DialogResult.OK == MessageBox.Show("Are you wanted to upadte " + txtCode.Text + " ?", "Confirmation!", MessageBoxButtons.OKCancel)) { oresult = oitembo.Update(oitemtype); } } else { oresult = oitembo.Create(oitemtype); } if (oresult.IsSuccess) { LoadItemType(); Clearformdata(); } else { MessageBox.Show("Not Saved" + oresult.ErrMsg + ""); } } }
private CItem Getformdata() { CItem oitem = new CItem(); CItemType oItemType = (CItemType)ddlItemType.SelectedItem; CItemGroup oitemgroup = (CItemGroup)ddlGroupNAme.SelectedItem; CUOM oUOM = (CUOM)ddlUOM.SelectedItem; CSize oSize = (CSize)cmbItemSize.SelectedItem; oitem.Item_OID = txthiddenitemid.Text; oitem.Item_Branch = currentBranch.CompBrn_Code; oitem.Item_GroupID = oitemgroup.Catg_OID; oitem.Item_TypeID = oItemType.ITyp_OID; oitem.Item_UOMID = oUOM.UOM_OID; oitem.Item_Code = txtItemCode.Text.Trim(); if (cmbItemSize.SelectedItem != null && txtICode.Text != "") { oitem.Item_ItemName = txtItemName.Text + "-" + txtICode.Text + "-- " + oSize.Size_Name; } if (txtICode.Text != "") { oitem.Item_ItemName = txtItemName.Text + "-" + txtICode.Text; } else { oitem.Item_ItemName = txtItemName.Text; } //oitem.Item_ItemName = txtItemName.Text; oitem.Item_Pprice = float.Parse(txtpprice.Text); oitem.Remarks = txtRemarks.Text; oitem.Item_RQTY = float.Parse(txtRQTY.Text); oitem.Item_Sprice = float.Parse(txtSprice.Text); oitem.Creator = currentUser.User_OID; oitem.CreationDate = DateTime.Now; oitem.UpdateBy = currentUser.User_OID; oitem.UpdateDate = DateTime.Now; oitem.CreationDate = DateTime.Now.Date; if (chkIsActive.Checked) { oitem.IsActive = "Y"; } else { oitem.IsActive = "N"; } oitem.Item_Priority = int.Parse(nupdnItemPriority.Text.Trim()); oitem.ItemImage = this.ItemImage; return(oitem); }
private void LLItemType_SelectedIndexChanged(object sender, EventArgs e) { if (LLItemType.SelectedIndex != -1) { if (LLItemType.Items.Count > 0) { CItemType oitemtype = (CItemType)LLItemType.SelectedItem; txttypeid.Text = oitemtype.ITyp_OID.ToString(); txtCode.Text = oitemtype.ITyp_Code; txtName.Text = oitemtype.ITyp_Name; txtRemarks.Text = oitemtype.Remarks; FormControlMode(1); } } }
private CItemType Getformdata() { CItemType oitemtype = new CItemType(); if (txttypeid.Text != "") { oitemtype.ITyp_OID = txttypeid.Text.Trim(); } oitemtype.ITyp_Branch = currentBranch.CompBrn_Code; oitemtype.ITyp_Code = txtCode.Text.Trim(); oitemtype.ITyp_Name = txtName.Text.Trim(); oitemtype.Remarks = txtRemarks.Text.Trim(); oitemtype.CreationDate = DateTime.Now; oitemtype.Creator = currentUser.User_OID; oitemtype.UpdateBy = currentUser.User_OID; oitemtype.UpdateDate = DateTime.Now; return(oitemtype); }
private void LoadItemType() { CItemBO oitembo = new CItemBO(); CResult oresult = new CResult(); CItemType oitemtype = new CItemType(); oresult = oitembo.ReadAll(oitemtype); if (oresult.IsSuccess) { ArrayList oItemList = oresult.Data as ArrayList; ddlItemType.DataSource = oItemList; ddlItemType.DisplayMember = "ITyp_Code"; ddlItemType.ValueMember = "ITyp_OID"; ddlItemType.SelectedIndex = 0; } else { ddlItemType.Text = "ERROR in loading"; } }
private void LoadItemType() { CItemBO oitembo = new CItemBO(); CResult oresult = new CResult(); CItemType oitemtype = new CItemType(); oresult = oitembo.ReadAll(oitemtype); if (oresult.IsSuccess) { try { LLItemType.DataSource = oresult.Data; LLItemType.DisplayMember = "ITyp_Code"; LLItemType.ValueMember = "ITyp_OID"; } catch (Exception ex) { } } else { MessageBox.Show(oresult.ErrMsg); } }