コード例 #1
0
        protected override void cmdAdd_Click(object sender, System.EventArgs e)
        {
            if (_facade == null)
            {
                _facade = new BenQGuru.eMES.Material.EquipmentFacade(base.DataProvider);
            }


            this.DataProvider.BeginTransaction();

            if (_facade.CheckEQPTSLogExists(this.txtEQPIDQuery.Text, EquipmentTSLogStatus.EquipmentTSLogStatus_New) > 0)
            {
                WebInfoPublish.Publish(this, "$EQPTSLog_Exists", this.languageComponent1);
            }
            else
            {
                PageCheckManager manager = new PageCheckManager();
                manager.Add(new LengthCheck(this.lblEqpTsInfoEdit, this.txtEqpTsInfoEdit, 400, true));
                if (!manager.Check())
                {
                    WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1);
                    return;
                }


                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                Domain.Equipment.EQPTSLog eqptsLog = new Domain.Equipment.EQPTSLog();
                eqptsLog.Eqpid        = this.txtEQPIDQuery.Text;
                eqptsLog.FindUser     = this.GetUserCode();
                eqptsLog.TsInfo       = FormatHelper.CleanString(this.txtEqpTsInfoEdit.Text, 400);
                eqptsLog.FindMdate    = dbDateTime.DBDate;
                eqptsLog.FindMtime    = dbDateTime.DBTime;
                eqptsLog.Status       = EquipmentTSLogStatus.EquipmentTSLogStatus_New;
                eqptsLog.Duration     = 0;
                eqptsLog.MaintainUser = this.GetUserCode();
                eqptsLog.Mdate        = dbDateTime.DBDate;
                eqptsLog.Mtime        = dbDateTime.DBTime;
                _facade.AddEQPTSLog(eqptsLog);
                //WebInfoPublish.Publish(this, "$AddEQPTSLog_Success", this.languageComponent1);
            }

            this.DataProvider.CommitTransaction();

            this.gridHelper.RefreshData();
        }
コード例 #2
0
        protected override object GetEditObject()
        {
            if (_facade == null)
            {
                _facade = new Material.EquipmentFacade(base.DataProvider);
            }

            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

            Domain.Equipment.EQPTSLog route = this._facade.CreateNewEQPTSLOG();

            route.Eqpid = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtEQPIDQuery.Text, 40));

            if (this.txtSerialEdit.Text.Trim() == string.Empty)
            {
                route.Serial = 0;
            }
            else
            {
                route.Serial = int.Parse(this.txtSerialEdit.Text);
            }
            route              = (Domain.Equipment.EQPTSLog) this._facade.GetEQPTSLog(route.Serial);
            route.TsInfo       = FormatHelper.CleanString(this.txtEqpTsInfoEdit.Text, 400);
            route.Memo         = FormatHelper.CleanString(this.txtEqpMemoEdit.Text, 400);
            route.Reason       = FormatHelper.CleanString(this.txtEqpReasonEdit.Text, 400);
            route.Result       = FormatHelper.CleanString(this.txtEqpResultEdit.Text, 400);
            route.Solution     = FormatHelper.CleanString(this.txtEqpSolutionEdit.Text, 400);
            route.Tstype       = FormatHelper.CleanString(this.drpEqpTSTypeEdit.SelectedValue, 40);
            route.MaintainUser = this.GetUserCode();
            route.Status       = EquipmentTSLogStatus.EquipmentTSLogStatus_Closed;
            route.Mdate        = dbDateTime.DBDate;
            route.Mtime        = dbDateTime.DBTime;
            DateTime findTime = new DateTime(route.FindMdate / 10000, (route.FindMdate / 100) % 100, route.FindMdate % 100,
                                             route.FindMtime / 10000, (route.FindMtime / 100) % 100, route.FindMtime % 100);

            route.Duration = (int)(dbDateTime.DateTime - findTime).TotalMinutes;
            return(route);
        }