protected void cmdAdd_ServerClick(object sender, System.EventArgs e)
        {
            object obj = this.GetEditObject();

            if (obj != null)
            {
                if (_apFacade == null)
                {
                    _apFacade = new SMTFacadeFactory(base.DataProvider).CreateArmorPlateFacade();
                }
                object ap = _apFacade.GetArmorPlate((obj as ArmorPlateVersionChangeList).ArmorPlateID);
                if (ap == null)
                {
                    WebInfoPublish.Publish(this, string.Format("$ArmorPlateID=[{0}],$Error_ArmorPlate_Not_Maintain", (obj as ArmorPlateVersionChangeList).ArmorPlateID), languageComponent1);
                    return;
                }
                (obj as ArmorPlateVersionChangeList).OldVersion    = (ap as ArmorPlate).Version;
                (obj as ArmorPlateVersionChangeList).BasePlateCode = (ap as ArmorPlate).BasePlateCode;
                (ap as ArmorPlate).Version      = (obj as ArmorPlateVersionChangeList).Version;
                (ap as ArmorPlate).MaintainUser = this.GetUserCode();
                this._apFacade.AddArmorPlateVersionChangeList(obj as ArmorPlateVersionChangeList);
                this._apFacade.UpdateArmorPlate(ap as ArmorPlate);
                this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize);
                this.RequestData();
                this.buttonHelper.PageActionStatusHandle(PageActionType.Add);
            }
        }
Beispiel #2
0
        private void cmdAdd_ServerClick(object sender, System.EventArgs e)
        {
            object obj = this.GetEditObject();

            if (obj != null)
            {
                if (_apFacade == null)
                {
                    _apFacade = new SMTFacadeFactory(base.DataProvider).CreateArmorPlateFacade();
                }
                object ap = _apFacade.GetArmorPlate((obj as ArmorPlateStatusChangeList).ArmorPlateID);
                if (ap == null)
                {
                    WebInfoPublish.Publish(this, string.Format("$ArmorPlateID=[{0}], $Error_ArmorPlate_Not_Maintain", (obj as ArmorPlateStatusChangeList).ArmorPlateID), languageComponent1);
                    return;
                }

                object apc = _apFacade.GetArmorPlateInUseContol((obj as ArmorPlateStatusChangeList).ArmorPlateID);
                if (apc != null)
                {
                    WebInfoPublish.Publish(this, string.Format("$ArmorPlateID=[{0}], $Error_ArmorPlate_Is_InUse", (obj as ArmorPlateStatusChangeList).ArmorPlateID), languageComponent1);
                    return;
                }

                (obj as ArmorPlateStatusChangeList).BasePlateCode = (ap as ArmorPlate).BasePlateCode;

                if (string.Compare((ap as ArmorPlate).Status, ArmorPlateStatus.StartUsing, true) == 0)
                {
                    (ap as ArmorPlate).Status = ArmorPlateStatus.EndUsing;
                    (obj as ArmorPlateStatusChangeList).Status    = ArmorPlateStatus.EndUsing;
                    (obj as ArmorPlateStatusChangeList).OldStatus = ArmorPlateStatus.StartUsing;
                }
                else
                {
                    (ap as ArmorPlate).Status = ArmorPlateStatus.StartUsing;
                    (obj as ArmorPlateStatusChangeList).Status    = ArmorPlateStatus.StartUsing;
                    (obj as ArmorPlateStatusChangeList).OldStatus = ArmorPlateStatus.EndUsing;
                }
                (ap as ArmorPlate).MaintainUser = this.GetUserCode();
                this._apFacade.AddArmorPlateStatusChangeList(obj as ArmorPlateStatusChangeList);
                this._apFacade.UpdateArmorPlate(ap as ArmorPlate);
                this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize);
                this.RequestData();
                this.buttonHelper.PageActionStatusHandle(PageActionType.Add);
            }
        }