Example #1
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (itemid > 0)
            {
                var result = MessageBox.Show("ARE YOU SURE", "Error", MessageBoxButtons.YesNo);

                if (DialogResult.Yes == result)
                {
                    RepositeryResponce responce = itemRepo.Remove(itemid);
                    if (responce.sucsess)
                    {
                        ShowMessageSucsess(responce.message);
                        reset();
                        loadGrid();
                    }
                    else
                    {
                        ShowMessageError(responce.message);
                    }
                }
                else if (DialogResult.No == result)
                {
                }
            }
        }
Example #2
0
        private void buttonsave_Click(object sender, EventArgs e)
        {
            string   grnnumber = textBoxGrnNum.Text;
            int      supplyier = (int)comboBoxSuplier.SelectedValue;
            DateTime dateTime  = dateTimePickerGrn.Value;

            pos_grnheader grnheader = new pos_grnheader
            {
                number  = grnnumber,
                suplier = supplyier,
                time    = dateTime,
                total   = 10,
            };

            RepositeryResponce repositeryResponce = grnHeaderRepo.saveGrn(grnheader);

            if (repositeryResponce.sucsess)
            {
                ShowMessageSucsess(repositeryResponce.message);
                textBoxGrnNum.Enabled     = false;
                comboBoxSuplier.Enabled   = false;
                dateTimePickerGrn.Enabled = false;
                var idobject = repositeryResponce.data;
                grnid = int.Parse(idobject.GetType().GetProperty("id").GetValue(idobject).ToString());
            }
            else
            {
                ShowMessageError(repositeryResponce.message);
            }
        }
Example #3
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            int    itemunit    = (int)comboBoxUnit.SelectedValue;
            int    catogory    = (int)comboBoxCatagory.SelectedValue;
            string name        = textBoxName.Text;
            string discription = textBoxDiscription.Text;

            RepositeryResponce repositeryResponce = itemRepo.Save(new pos_item
            {
                id           = itemid,
                itemcategory = catogory,
                itemname     = name,
                unit         = itemunit,
                discreption  = discription,
            });

            if (repositeryResponce.sucsess)
            {
                loadGrid();
                ShowMessageSucsess(repositeryResponce.message);
            }
            else
            {
                ShowMessageError(repositeryResponce.message);
            }
        }
Example #4
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            string  name           = textBoxName.Text;
            string  address        = textBoxAddres.Text;
            int     contact        = int.Parse(textBoxContact.Text);
            decimal cusloyltypoint = decimal.Parse(textBoxLoyalty.Text);

            pos_customer customer = new pos_customer
            {
                id = customerid,
                customeraddrees = address,
                customername    = name,
                customercontact = contact,
                loyaltypoint    = cusloyltypoint,
            };

            RepositeryResponce repositeryResponce = customerRepo.Save(customer);

            if (repositeryResponce.sucsess)
            {
                loadDatagrid();
                Reset();
                ShowMessageSucsess(repositeryResponce.message);
            }
            else
            {
                ShowMessageError(repositeryResponce.message);
            }
        }
Example #5
0
        private void buttonSaveItems_Click(object sender, EventArgs e)
        {
            List <pos_grnitem> grnitems = new List <pos_grnitem>();

            foreach (DataGridViewRow row in dataGridViewGrn.Rows)
            {
                pos_grnitem grnitem = new pos_grnitem();
                if (row.Cells[0].Value != null || row.Cells[2].Value != null || row.Cells[3].Value != null)
                {
                    grnitem.itemid      = (int)row.Cells[0].Value;
                    grnitem.itemquntity = (decimal)row.Cells[2].Value;
                    grnitem.itemcost    = (decimal)row.Cells[3].Value;
                    grnitem.grnid       = grnid;

                    grnitems.Add(grnitem);
                }
                else
                {
                }
            }

            if (grnitems.Count > 0)
            {
                RepositeryResponce responce = grnItemRepo.SaveGrnItems(grnitems);

                if (responce.sucsess)
                {
                    ShowMessageSucsess(responce.message);
                }
                else
                {
                    ShowMessageError(responce.message);
                }
            }
        }
Example #6
0
        public RepositeryResponce Remove(int id)
        {
            int sucses = 0;
            RepositeryResponce responce = new RepositeryResponce();

            try
            {
                pos_item item = getByItemId(id);

                dbentities.pos_item.Remove(item);
                sucses = dbentities.SaveChanges();
            }catch (Exception exception)
            {
                responce.sucsess = false;
                responce.message = exception.Message;
            }

            if (sucses == 1)
            {
                responce.sucsess = true;
                responce.message = CatgoryConstant.Savesucses;
                return(responce);
            }
            else
            {
                pos_item item = getByItemId(id);
                dbentities.Entry(item).State = EntityState.Unchanged;
                dbentities.SaveChanges();
                responce.sucsess = false;
                responce.message = CatgoryConstant.SaveError;
                return(responce);
            }
        }
Example #7
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            RepositeryResponce repositeryResponce = customerRepo.Remove(customerid);

            if (repositeryResponce.sucsess)
            {
                loadDatagrid();
                Reset();
                ShowMessageSucsess(repositeryResponce.message);
            }
            else
            {
                ShowMessageError(repositeryResponce.message);
            }
        }
Example #8
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            RepositeryResponce responce = itemCategoryRepo.remove(catogoryid);

            if (responce.sucsess)
            {
                textBoxitemCatogory.Clear();
                loadDatagrid();
                ShowMessageSucsess(responce.message);
            }
            else
            {
                ShowMessageError(responce.message);
            }
        }
Example #9
0
        private void buttonsave_Click(object sender, EventArgs e)
        {
            string             catogoryname = textBoxitemCatogory.Text;
            RepositeryResponce responce     = itemCategoryRepo.Save(new pos_itemcategory {
                id = catogoryid, category = catogoryname
            });

            if (responce.sucsess)
            {
                loadDatagrid();
                ShowMessageSucsess(responce.message);
            }
            else
            {
                ShowMessageError(responce.message);
            }
        }
Example #10
0
        public RepositeryResponce Save(pos_item item)
        {
            int sucses = 0;
            RepositeryResponce responce = new RepositeryResponce();

            try
            {
                if (item.id > 0)
                {
                    var current = dbentities.pos_item.Find(item.id);
                    dbentities.Entry(current).CurrentValues.SetValues(item);
                }
                else
                {
                    dbentities.pos_item.Add(item);
                }

                sucses = dbentities.SaveChanges();
            }
            catch (Exception exception)
            {
                responce.sucsess = false;
                responce.message = exception.Message;
                dbentities.pos_item.Remove(item);
                return(responce);
            }
            if (sucses == 1)
            {
                responce.sucsess = true;
                responce.message = CatgoryConstant.Savesucses;
                return(responce);
            }
            else
            {
                responce.sucsess = false;
                responce.message = CatgoryConstant.SaveError;
                return(responce);
            }
        }