コード例 #1
0
        protected void rdFryersGrid_OnItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "delete":
                HiddenField hdnDeepFryerId = e.Item.FindControl("hdnDeepFryerId") as HiddenField;

                if (hdnDeepFryerId != null)
                {
                    DeepFryerEntity deepFryer = new DeepFryerEntity(Convert.ToInt32(hdnDeepFryerId.Value));
                    deepFryer.IsActive = false;
                    deepFryer.Save();

                    ChangeLogEntity cle = new ChangeLogEntity();
                    cle.UserId       = sm.AuthenticatedUser.UserId;
                    cle.ChangeDate   = DateTime.Now;
                    cle.ChangeTypeId = (int)ChangeTypeEntity.ChangeTypes.FryerRemoved;
                    DeepFryerChangeLogEntity dfcle = new DeepFryerChangeLogEntity();
                    dfcle.DeepFryerId = deepFryer.DeepFryerId;
                    dfcle.ChangeLog   = cle;
                    dfcle.Save(true);
                }
                break;

            default:
                break;
            }
        }
コード例 #2
0
 /// <summary> setups the sync logic for member _deepFryer</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncDeepFryer(IEntity2 relatedEntity)
 {
     if (_deepFryer != relatedEntity)
     {
         DesetupSyncDeepFryer(true, true);
         _deepFryer = (DeepFryerEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity(_deepFryer, new PropertyChangedEventHandler(OnDeepFryerPropertyChanged), "DeepFryer", DeepFryerChangeLogEntity.Relations.DeepFryerEntityUsingDeepFryerId, true, new string[] {  });
     }
 }
コード例 #3
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _changeLog = null;
            _deepFryer = null;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END

            OnInitClassMembersComplete();
        }
コード例 #4
0
        protected void btnSaveFryers_Click(object sender, EventArgs e)
        {
            foreach (GridDataItem item in rdFryersGrid.Items)
            {
                TextBox     txtDeepFryerName          = item.FindControl("txtDeepFryerName") as TextBox;
                TextBox     txtDeepFryerDescription   = item.FindControl("txtDeepFryerDescription") as TextBox;
                TextBox     txtDeepFryerSizeInGallons = item.FindControl("txtDeepFryerSizeInGallons") as TextBox;
                HiddenField hdnDeepFryerId            = item.FindControl("hdnDeepFryerId") as HiddenField;
                HiddenField hdnOrigSize = item.FindControl("hdnOrigSize") as HiddenField;

                if (hdnDeepFryerId != null)
                {
                    DeepFryerEntity deepFryer = new DeepFryerEntity(Convert.ToInt32(hdnDeepFryerId.Value));
                    deepFryer.Name        = txtDeepFryerName.Text.Trim();
                    deepFryer.Description = txtDeepFryerDescription.Text.Trim();
                    if (deepFryer.SizeInGallons != null)
                    {
                        try
                        {
                            double orgSize = Convert.ToDouble(hdnOrigSize.Value);
                            double newSize = Convert.ToDouble(txtDeepFryerSizeInGallons.Text.Trim());

                            if (orgSize != newSize)
                            {
                                ChangeLogEntity cle = new ChangeLogEntity();
                                cle.UserId       = sm.AuthenticatedUser.UserId;
                                cle.ChangeDate   = DateTime.Now;
                                cle.ChangeTypeId = newSize > orgSize ? (int)ChangeTypeEntity.ChangeTypes.FryerSizeIncrease : (int)ChangeTypeEntity.ChangeTypes.FryerSizeDecrease;
                                DeepFryerChangeLogEntity dfcle = new DeepFryerChangeLogEntity();
                                dfcle.DeepFryerId = deepFryer.DeepFryerId;
                                dfcle.ChangeLog   = cle;
                                dfcle.Save(true);
                            }
                        }
                        catch { }
                    }


                    if (txtDeepFryerSizeInGallons.Text.Trim().Length > 0)
                    {
                        deepFryer.SizeInGallons = Convert.ToDouble(txtDeepFryerSizeInGallons.Text.Trim());
                    }



                    deepFryer.Save();
                }
            }

            Response.Redirect("~/EditAccount.aspx?acctId=" + _account.AccountId.ToString());
        }
コード例 #5
0
        protected void btnSaveDeepFryer_Click(object sender, EventArgs e)
        {
            if (txtDeepFryerName.Text.Trim().Length > 0)
            {
                _currentFryer = new DeepFryerEntity(Convert.ToInt32(hdnDeepFryerId.Value));
                double sizeInGallons = 0;

                if (txtSizeInGallons.Text.Trim().Length > 0)
                {
                    try
                    {
                        sizeInGallons = Convert.ToDouble(txtSizeInGallons.Text.Trim());
                    }
                    catch
                    {
                        //TODO
                    }
                }
                _currentFryer.Name              = txtDeepFryerName.Text.Trim();
                _currentFryer.Description       = txtDeepFryerDescription.Text.Trim().Length > 0 ? txtDeepFryerDescription.Text.Trim() : null;
                _currentFryer.ServiceLocationId = _serviceLocation.ServiceLocationId;
                if (sizeInGallons > 0)
                {
                    _currentFryer.SizeInGallons = sizeInGallons;
                }
                else
                {
                    _currentFryer.SizeInGallons = null;
                }
                _currentFryer.Save();

                ChangeLogEntity cle = new ChangeLogEntity();
                cle.UserId       = sm.AuthenticatedUser.UserId;
                cle.ChangeDate   = DateTime.Now;
                cle.ChangeTypeId = (int)ChangeTypeEntity.ChangeTypes.FryerAdded;
                DeepFryerChangeLogEntity dfcle = new DeepFryerChangeLogEntity();
                dfcle.DeepFryerId = _currentFryer.DeepFryerId;
                dfcle.ChangeLog   = cle;
                dfcle.Save(true);

                rdFryersGrid.Rebind();
                divAddNewFryer.Visible = false;
                btnAddNewFryer.Visible = true;
                //    Response.Redirect("~/EditServiceLocation.aspx?serviceLocationId=" + _currentFryer.ServiceLocationId.ToString() + "&tab=1");
            }
        }
コード例 #6
0
        protected void rptFryers_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.IsDataItem())
            {
                DeepFryerEntity deepFryer = e.Item.DataItem as DeepFryerEntity;

                LinkButton  lnkBtnEditDeepFryer     = e.Item.FindControl("lnkBtnEditDeepFryer") as LinkButton;
                Label       lblDeepFryerDescription = e.Item.FindControl("lblDeepFryerDescription") as Label;
                Label       lblSizeInGallons        = e.Item.FindControl("lblSizeInGallons") as Label;
                HiddenField hdnDeepFryerId          = e.Item.FindControl("hdnDeepFryerId") as HiddenField;

                hdnDeepFryerId.Value         = deepFryer.DeepFryerId.ToString();
                lnkBtnEditDeepFryer.Text     = deepFryer.Name;
                lblDeepFryerDescription.Text = deepFryer.Description != null ? deepFryer.Description : "";
                lnkBtnEditDeepFryer.ToolTip  = deepFryer.Description != null ? deepFryer.Description : "";
                lblSizeInGallons.Text        = deepFryer.SizeInGallons != null?deepFryer.SizeInGallons.Value.ToString() : "";
            }
        }
コード例 #7
0
        protected DeepFryerChangeLogEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _changeLog = (ChangeLogEntity)info.GetValue("_changeLog", typeof(ChangeLogEntity));
                if (_changeLog != null)
                {
                    _changeLog.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _deepFryer = (DeepFryerEntity)info.GetValue("_deepFryer", typeof(DeepFryerEntity));
                if (_deepFryer != null)
                {
                    _deepFryer.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
コード例 #8
0
 /// <summary> Removes the sync logic for member _deepFryer</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncDeepFryer(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_deepFryer, new PropertyChangedEventHandler(OnDeepFryerPropertyChanged), "DeepFryer", DeepFryerChangeLogEntity.Relations.DeepFryerEntityUsingDeepFryerId, true, signalRelatedEntity, "DeepFryerChangeLog", resetFKFields, new int[] { (int)DeepFryerChangeLogFieldIndex.DeepFryerId });
     _deepFryer = null;
 }