Ejemplo n.º 1
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);
                }
            }
        }
Ejemplo n.º 2
0
        public RepositeryResponce saveGrn(pos_grnitem grnitem)
        {
            int sucses = 0;

            try
            {
                dbentities.pos_grnitem.Add(grnitem);
                sucses = dbentities.SaveChanges();
            }
            catch (Exception exception)
            {
                return(new RepositeryResponce(false, GrnConstances.SAVEERROR, null));
            }
            if (sucses == 1)
            {
                return(new RepositeryResponce(true, GrnConstances.SAVESUCESS, null));
            }
            else
            {
                return(new RepositeryResponce(false, GrnConstances.SAVEERROR, null));
            }
        }