Example #1
0
        private void AddNewPackage(int idjob)
        {
            PACKAGE p;

            using (CWMEntities cwm = new CWMEntities(EnCon))
            {
                foreach (ListItem c in chblPrice.Items)
                {
                    if (c.Selected)
                    {
                        p         = new PACKAGE();
                        p.IDJOB   = idjob;
                        p.IDPRICE = int.Parse(c.Value);
                        if ((int)Session["special"] == 0)
                        {
                            p.COST = GetCost(c.Value);
                        }
                        else
                        {
                            p.COST = 0;
                        }
                        cwm.AddToPACKAGE(p);
                    }
                }
                cwm.SaveChanges();
            }
            //CrystalReport1 cr = new CrystalReport1();
            //cr.SetDataSource(
        }
Example #2
0
        private void AddNewPackage(int idjob)
        {
            PACKAGE p;

            using (CWMEntities cwm = new CWMEntities(EnCon))
            {
                foreach (ListItem c in chblPrice.Items)
                {
                    if (c.Selected)
                    {
                        p         = new PACKAGE();
                        p.IDJOB   = idjob;
                        p.IDPRICE = int.Parse(c.Value);
                        if (ddlSpecial.Text == "НЕТ")
                        {
                            p.COST = GetCost(c.Value);
                        }
                        else
                        {
                            p.COST = 0;
                        }

                        cwm.AddToPACKAGE(p);
                    }
                }
                DeletedServices = Session["delp"] as List <int>;
                foreach (int i in DeletedServices)
                {
                    p         = new PACKAGE();
                    p.IDJOB   = idjob;
                    p.IDPRICE = int.Parse(i.ToString());
                    if (ddlSpecial.Text == "НЕТ")
                    {
                        p.COST = GetCost(i.ToString());
                    }
                    else
                    {
                        p.COST = 0;
                    }

                    p.DELETED = true;
                    cwm.AddToPACKAGE(p);
                }
                cwm.SaveChanges();
            }
        }