protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var q = (from p in db.Cultures
                        where p.UserName == HttpContext.Current.User.Identity.Name
                        where p.DurationId == dm.getDurationId()
                        select p).First();

                q.ValueOfCulture += Convert.ToInt32(txtCount.Text);

                db.SubmitChanges();
            }
            catch (Exception)
            {
                Culture c = new Culture();

                c.UserName = HttpContext.Current.User.Identity.Name;
                c.DurationId = dm.getDurationId();
                c.ValueOfCulture = Convert.ToInt32(txtCount.Text);

                db.Cultures.InsertOnSubmit(c);
                db.SubmitChanges();
            }
        }
示例#2
0
        public void updateData(Culture data)
        {
            var q = (from p in db.Cultures
                    where p.UserName == username
                    where p.DurationId == durationId
                     where p.CultureId == data.CultureId
                    select p).First();

            q.ValueOfCulture = data.ValueOfCulture;

            db.SubmitChanges();
        }
        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            Culture ct = new Culture();

            ct.CultureId = Convert.ToInt32(((HiddenField)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["ValueOfCulture"], "hidEditId")).Value);//Convert.ToInt32(((HiddenField)ASPxGridView1.FindRowCellTemplateControl(ASPxGridView1.FindVisibleIndexByKeyValue(e.Keys[ASPxGridView1.KeyFieldName]), (GridViewDataColumn)ASPxGridView1.Columns["ValueOfCulture"], "hidEditId")).Value);
            ct.ValueOfCulture = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["ValueOfCulture"], "txtEditValueOfCulture")).Text);

            dll_Culture dll = new dll_Culture(username, dr.getDurationId());
            dll.updateData(ct);
            this.ASPxGridView1.CancelEdit();
            e.Cancel = true;
            FillGridView();
        }
        protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            Culture ct = new Culture();

            ct.UserName = username;
            ct.DurationId = dr.getDurationId();

            ct.ValueOfCulture = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["ValueOfCulture"], "txtEditValueOfCulture")).Text);

            dll_Culture dll = new dll_Culture(username, dr.getDurationId());
            dll.insertData(ct);
            e.Cancel = true;
            ASPxGridView1.CancelEdit();
            FillGridView();
        }
示例#5
0
 public void insertData(Culture data)
 {
     db.Cultures.InsertOnSubmit(data);
     db.SubmitChanges();
 }
 partial void DeleteCulture(Culture instance);
 partial void UpdateCulture(Culture instance);
 partial void InsertCulture(Culture instance);
		private void detach_Cultures(Culture entity)
		{
			this.SendPropertyChanging();
			entity.DurationCulture = null;
		}