public void updateData(CenterService data)
        {
            var q = (from p in db.CenterServices
                    where p.UserName == username
                    where p.DurationId == durationId
                     where p.CenterServiceId == data.CenterServiceId
                    select p).First();

            //q.ValueOfCulture = data.ValueOfCulture;

            db.SubmitChanges();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            CenterService cs = new CenterService();

            cs.UserName = HttpContext.Current.User.Identity.Name;
            cs.DurationId = dm.getDurationId();

            cs.PositionTypeId = Convert.ToInt32(DropDownList1.SelectedValue);
            cs.CenterServiceValue = (DropDownList1.SelectedValue == "15" || DropDownList1.SelectedValue == "16")?Convert.ToInt32(txtCount.Text):1;

            db.CenterServices.InsertOnSubmit(cs);
            db.SubmitChanges();
        }
 partial void DeleteCenterService(CenterService instance);
 partial void UpdateCenterService(CenterService instance);
 partial void InsertCenterService(CenterService instance);
		private void detach_CenterServices(CenterService entity)
		{
			this.SendPropertyChanging();
			entity.PositionType = null;
		}
        private void saveData(int id)
        {
            try
            {
                var q = (from p in db.CenterServices
                         where p.UserName == username
                         where p.DurationId == durationId
                         where p.PositionTypeId == id
                         select p).First();
            }
            catch (Exception)
            {
                CenterService cv = new CenterService();
                cv.UserName = username;
                cv.DurationId = durationId;
                cv.PositionTypeId = id;
                cv.CenterServiceValue = 1;

                db.CenterServices.InsertOnSubmit(cv);
                db.SubmitChanges();
            }
        }
 public void insertData(CenterService data)
 {
     db.CenterServices.InsertOnSubmit(data);
     db.SubmitChanges();
 }