/// <summary> /// when Update /// </summary> /// <param name="singleItemDetails"></param> /// <param name="userName"></param> public FrmAddItem(BLL.ClsItemData singleItemDetails, string userName) { COM_MESSAGE = new CommonControls.Classes.ClsMessages(); VALIDATION = new CommonControls.Classes.ClsValidation(); COMM_METHODS = new CommonControls.Classes.ClsCommonMethods(); CREATEITEM = new BLL.ClsItemData(); MANAGEDB = new BLL.ClsInventoryManageDbChanges(); InitializeComponent(); txt_itemID.Text = singleItemDetails._itemId.ToString(); txt_itemCode.Text = singleItemDetails._itemCode.ToString(); txt_altName.Text = singleItemDetails._altName; txt_itemName.Text = singleItemDetails._itemName; txt_itemCode.Enabled = false; dropDown_itemType.DataSource = MANAGEDB.getItemTypeList(); dropDown_itemType.DisplayMember = "itemType"; dropDown_itemType.ValueMember = "typeId"; dropDown_itemType.BindingContext = this.BindingContext; dropDown_itemType.SelectedIndex = dropDown_itemType.FindString(singleItemDetails._itemTypeName); btn_cancel.Visible = true; btn_create.Visible = false; btn_delete.Visible = true; btn_update.Visible = true; IS_UPDATING = true; USERNAME = userName; this.StartPosition = FormStartPosition.CenterScreen; this.ActiveControl = txt_itemCode; }
/// <summary> /// when create item /// </summary> /// <param name="userName"></param> public FrmAddItem(string userName) { COM_MESSAGE = new CommonControls.Classes.ClsMessages(); VALIDATION = new CommonControls.Classes.ClsValidation(); COMM_METHODS = new CommonControls.Classes.ClsCommonMethods(); CREATEITEM = new BLL.ClsItemData(); MANAGEDB = new BLL.ClsInventoryManageDbChanges(); InitializeComponent(); txt_itemID.Text = MANAGEDB.getMaxItemId().ToString(); //fill data for itemType from db dropDown_itemType.DataSource = MANAGEDB.getItemTypeList(); dropDown_itemType.DisplayMember = "itemType"; dropDown_itemType.ValueMember = "typeId"; dropDown_itemType.BindingContext = this.BindingContext; dropDown_itemType.SelectedIndex = -1; USERNAME = userName; btn_cancel.Visible = true; btn_create.Visible = true; btn_delete.Visible = false; btn_update.Visible = false; this.WindowState = FormWindowState.Maximized; this.ActiveControl = txt_itemCode; }