예제 #1
0
        private void UpdateReCalValue(ACS320_Process resultDo)
        {
            if (this.InvokeRequired)
            {
                this.Invoke((Action)(() =>
                {
                    txtActualMOH.DecimalValue = resultDo.ActMOH;
                    txtActualCapacity.DecimalValue = resultDo.ActCapaUsed;
                    txtActualMOHRate.DecimalValue = resultDo.ActCostRate;
                    txtSoldLiter.DecimalValue = resultDo.SoldLiter;
                    txtEndLiter.DecimalValue = resultDo.EndingLiter;
                    txtSoldLiterOEM.DecimalValue = resultDo.SoldLiterOEM;
                    txtEndLiterOEM.DecimalValue = resultDo.EndingLiterOEM;
                }));

                return;
            }
        }
예제 #2
0
        public ACS320_Process CalculateData(int year, int period, string byUser, SqlInfoMessageEventHandler infoMessageHandler = null)
        {
            SqlConnection conn = new SqlConnection(AppConfig.ConnectionString);

            conn.FireInfoMessageEventOnUserErrors = true; // This flag allow receive message realtime.

            SqlData db = new SqlData(conn);

            try
            {
                db.BeginTrans();

                //#####################
                //# Process Calcualte
                //#  While processing, reponse progress periodically.
                //#####################
                conn.InfoMessage += infoMessageHandler;
                ACS320_Process result = StoreProcedure.sp_ACS320_Process_CalculateData(db, year, period, byUser);

                //#####################
                //# Update Calculation Status
                //#####################
                conn.InfoMessage -= infoMessageHandler;
                StoreProcedure.sp_ACS320_Update_ProcessControl(db, year, period, byUser);

                db.CommitTrans();

                return(result);
            }
            catch (Exception ex)
            {
                if (db.HasTransaction)
                {
                    db.RollbackTrans();
                }

                throw;
            }
            finally
            {
                db.Close();
            }
        }
예제 #3
0
        private void UpdateProgressValue(ACS320_Process resultDo)
        {
            if (this.InvokeRequired)
            {
                this.Invoke((Action)(() =>
                {
                    txtActualMOH.DecimalValue = resultDo.ActMOH;
                    txtActualCapacity.DecimalValue = resultDo.ActCapaUsed;
                    txtActualMOHRate.DecimalValue = resultDo.ActCostRate;
                    txtSoldLiter.DecimalValue = resultDo.SoldLiter;
                    txtEndLiter.DecimalValue = resultDo.EndingLiter;
                    txtSoldLiterOEM.DecimalValue = resultDo.SoldLiterOEM;
                    txtEndLiterOEM.DecimalValue = resultDo.EndingLiterOEM;

                    txtActualMOH.Enabled = true;
                    txtActualCapacity.Enabled = true;
                    txtSoldLiter.Enabled = true;
                    txtEndLiter.Enabled = true;
                    txtSoldLiterOEM.Enabled = true;
                    txtEndLiterOEM.Enabled = true;


                    bool bRecal = AppEnvironment.Permission.AllowPermission(AppEnvironment.UserLogin, this.GetType().FullName, "ReCalculate");
                    if (bRecal)
                    {
                        btnRecal.Enabled = true;
                    }
                    else
                    {
                        btnRecal.Enabled = false;
                    }
                }));

                return;
            }
        }
예제 #4
0
        public ACS320_Process ReCalculateData(int year, int period, decimal pActMOH, decimal pActCapaUsed, decimal pSoldLiter, decimal pEndingLiter, decimal pSoldLiterOEM, decimal pEndingLiterOEM, string byUser)
        {
            ACS320_Process result = StoreProcedure.sp_ACS320_Process_ReCal(AppEnvironment.Database, year, period, pActMOH, pActCapaUsed, pSoldLiter, pEndingLiter, pSoldLiterOEM, pEndingLiterOEM, byUser);

            return(result);
        }