示例#1
0
        public void BindToControl(Control control, DataSet ds, string sDisplayMember, string sValueMumber, bool bAll)
        {
            try
            {
                if (ds.Tables.Count > 0)
                {
                    if (control is BISTel.PeakPerformance.Client.BISTelControl.BComboBox)
                    {
                        BISTel.PeakPerformance.Client.BISTelControl.BComboBox bComboBox = (BISTel.PeakPerformance.Client.BISTelControl.BComboBox)control;

                        bComboBox.Items.Clear();

                        //if (bAll)
                        //    combo.Items.Add(Definition.VARIABLE_ALL); //ALL
                        //else
                        //    combo.Items.Remove(Definition.VARIABLE_ALL);

                        bComboBox.BeginUpdate();

                        if (sDisplayMember != "")
                            bComboBox.DisplayMember = sDisplayMember;

                        if (sValueMumber != "")
                            bComboBox.ValueMember = sValueMumber;

                        if (DSUtil.GetResultSucceed(ds) != 0)
                        {
                            bComboBox.DataSource = ds.Tables[0];

                            //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            //{
                            //    bComboBox.Items.Add(ds.Tables[0].Rows[i][0].ToString());
                            //}
                            bComboBox.EndUpdate();

                            if (bComboBox.Items.Count > 0)
                            {
                                bComboBox.SelectedIndex = 0;
                            }
                        }
                        else
                            bComboBox.EndUpdate();
                    }
                    else if (control is BISTel.PeakPerformance.Client.BISTelControl.BCheckCombo)
                    {
                        BISTel.PeakPerformance.Client.BISTelControl.BCheckCombo bCheckComboBox = (BISTel.PeakPerformance.Client.BISTelControl.BCheckCombo)control;

                        bCheckComboBox.chkBox.Items.Clear();

                        bCheckComboBox.chkBox.BeginUpdate();

                        if (DSUtil.GetResultSucceed(ds) != 0)
                        {
                            ArrayList alItemList = new ArrayList();
                            string[] saItemList = new string[ds.Tables[0].Rows.Count];
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                alItemList.Add(ds.Tables[0].Rows[i][sDisplayMember].ToString());
                                saItemList[i] = ds.Tables[0].Rows[i][sDisplayMember].ToString();
                            }

                            if (sDisplayMember != "")
                                bCheckComboBox.DisplayMember = sDisplayMember;

                            if (sValueMumber != "")
                                bCheckComboBox.ValueMember = sValueMumber;

                            bCheckComboBox.DataSource = ds.Tables[0];

                            //string[] saItemList = (string[])alItemList.ToArray(typeof(string[]));

                            //bCheckComboBox.AddItems(saItemList);

                            bCheckComboBox.chkBox.EndUpdate();
                            bCheckComboBox.chkBox.SelectedIndex = 0;
                        }
                        else
                            bCheckComboBox.chkBox.EndUpdate();
                    }
                    else if (control is System.Windows.Forms.ListBox)
                    {
                        System.Windows.Forms.ListBox lstbox = (System.Windows.Forms.ListBox)control;

                        lstbox.Items.Clear();

                        lstbox.BeginUpdate();

                        if (DSUtil.GetResultSucceed(ds) != 0)
                        {
                            ArrayList alItemList = new ArrayList();
                            string[] saItemList = new string[ds.Tables[0].Rows.Count];
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                alItemList.Add(ds.Tables[0].Rows[i][sDisplayMember].ToString());
                                saItemList[i] = ds.Tables[0].Rows[i][sDisplayMember].ToString();
                            }

                            ////string[] saItemList = (string[])alItemList.ToArray(typeof(string[]));

                            //lstbox.Items.AddRange(saItemList);
                            ////lstbox.DataSource = ds;

                            if (sDisplayMember != "")
                                lstbox.DisplayMember = sDisplayMember;

                            if (sValueMumber != "")
                                lstbox.ValueMember = sValueMumber;

                            lstbox.DataSource = ds.Tables[0];
                            lstbox.EndUpdate();
                        }
                        else
                            lstbox.EndUpdate();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public bool InsertAnalysisChartConfiguration(byte[] baData)
        {
            bool bSuccess = false;

            DataSet       dsResult      = new DataSet();
            DataTable     dt            = new DataTable();
            LinkedList    llstFieldData = new LinkedList();
            LinkedList    llstData      = new LinkedList();
            StringBuilder sb            = new StringBuilder();
            decimal       dRawID        = 0;
            string        sUserID       = string.Empty;

            try
            {
                llstData.SetSerialData(baData);

                if (llstData[Definition.DynamicCondition_Condition_key.USER_ID] != null)
                {
                    sUserID = llstData[Definition.DynamicCondition_Condition_key.USER_ID].ToString();
                }

                if (llstData[Definition.CONDITION_KEY_DATA] != null)
                {
                    dt = (DataTable)llstData[Definition.CONDITION_KEY_DATA];
                }

                DataRow drDel = null;

                base.BeginTrans();

                foreach (DataRow dr in dt.Rows)
                {
                    llstFieldData.Clear();
                    sb = new StringBuilder();
                    if (dr.RowState == DataRowState.Deleted)
                    {
                        drDel = dr;
                        drDel.RejectChanges();
                        sb.AppendFormat("Where RAWID ={0}", drDel[COLUMN.RAWID].ToString());
                        base.Delete(TABLE.ANALYSISCHAT_CONFIG_SPC, sb.ToString(), new LinkedList());
                        if (base.ErrorMessage.Length > 0)
                        {
                            DSUtil.SetResult(dsResult, 0, "", base.ErrorMessage);
                            base.RollBack();
                            bSuccess = false;
                            return(bSuccess);
                        }
                    }
                    else if (dr.RowState == DataRowState.Added)
                    {
                        dRawID = base.GetSequence(SEQUENCE.SEQ_ANALYSISCHAT_CONFIG_SPC);
                        llstFieldData.Add(COLUMN.RAWID, dRawID);
                        llstFieldData.Add(COLUMN.LOCATION_RAWID, dr[COLUMN.LOCATION_RAWID]);
                        llstFieldData.Add(COLUMN.USER_ID, dr[COLUMN.USER_ID]);
                        llstFieldData.Add(COLUMN.CHART_CODE, dr[COLUMN.CHART_CODE]);
                        llstFieldData.Add(COLUMN.CHART_NAME, dr[COLUMN.CHART_NAME]);
                        llstFieldData.Add(COLUMN.CHART_ALIAS, dr[COLUMN.CHART_ALIAS]);
                        llstFieldData.Add(COLUMN.CHART_LIST, dr[COLUMN.CHART_LIST]);
                        llstFieldData.Add(COLUMN.FROM_NOW, dr[COLUMN.FROM_NOW]);
                        llstFieldData.Add(COLUMN.PUBLIC_YN, dr[COLUMN.PUBLIC_YN]);
                        llstFieldData.Add(COLUMN.USE_YN, dr[COLUMN.USE_YN]);
                        llstFieldData.Add(COLUMN.SEARCH_YN, dr[COLUMN.SEARCH_YN]);
                        llstFieldData.Add(string.Format("{0}+SYSTIMESTAMP", COLUMN.CREATE_DTTS), "");

                        base.Insert(TABLE.ANALYSISCHAT_CONFIG_SPC, llstFieldData);
                        if (base.ErrorMessage.Length > 0)
                        {
                            DSUtil.SetResult(dsResult, 0, "", base.ErrorMessage);
                            base.RollBack();
                            bSuccess = false;
                            return(bSuccess);
                        }
                        dr[COLUMN.RAWID] = dRawID;
                    }
                    else if (dr.RowState == DataRowState.Modified || dr["_MODIFY"].ToString().ToUpper() == "TRUE")
                    {
                        dRawID = decimal.Parse(dr[COLUMN.RAWID].ToString());
                        llstFieldData.Add(COLUMN.LOCATION_RAWID, dr[COLUMN.LOCATION_RAWID]);
                        llstFieldData.Add(COLUMN.CHART_CODE, dr[COLUMN.CHART_CODE]);
                        llstFieldData.Add(COLUMN.CHART_NAME, dr[COLUMN.CHART_NAME]);
                        llstFieldData.Add(COLUMN.CHART_ALIAS, dr[COLUMN.CHART_ALIAS]);
                        llstFieldData.Add(COLUMN.CHART_LIST, dr[COLUMN.CHART_LIST]);
                        llstFieldData.Add(COLUMN.FROM_NOW, dr[COLUMN.FROM_NOW]);
                        llstFieldData.Add(COLUMN.PUBLIC_YN, dr[COLUMN.PUBLIC_YN]);
                        llstFieldData.Add(COLUMN.USE_YN, dr[COLUMN.USE_YN]);
                        llstFieldData.Add(COLUMN.SEARCH_YN, dr[COLUMN.SEARCH_YN]);
                        llstFieldData.Add(COLUMN.LAST_UPDATE_BY, sUserID);
                        llstFieldData.Add(string.Format("{0}+SYSTIMESTAMP", COLUMN.LAST_UPDATE_DTTS), "");

                        sb.AppendFormat("Where RAWID ={0}", dRawID);
                        base.Update(TABLE.ANALYSISCHAT_CONFIG_SPC, llstFieldData, sb.ToString(), new LinkedList());
                        if (base.ErrorMessage.Length > 0)
                        {
                            DSUtil.SetResult(dsResult, 0, "", base.ErrorMessage);
                            base.RollBack();
                            bSuccess = false;
                            return(bSuccess);
                        }
                    }
                }
                base.Commit();
                bSuccess = true;
            }
            catch (Exception ex)
            {
                bSuccess = false;
                base.RollBack();
                DSUtil.SetResult(dsResult, 0, "", ex.Message);

                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, new string[] { ex.Message, ex.Source, ex.StackTrace });
            }
            finally
            {
                if (llstFieldData != null)
                {
                    llstFieldData = null;
                }
            }

            return(bSuccess);
        }
示例#3
0
        static async Task <string> repricer()
        {
            int    priceDiffer = 0;
            string subject     = "Repricer";
            string body        = null;
            string log         = null;
            int    i           = 0;
            int    count       = db.PostedListings.Count();

            foreach (PostedListing listing in db.PostedListings.ToList())
            {
                Console.WriteLine((++i) + "/" + count.ToString());
                try {
                    var r = await sclib.Scrape.GetDetail(listing.SourceUrl);

                    //Console.WriteLine(listing.Title);
                    //Console.WriteLine(r.price);
                    if (r.price != listing.SupplierPrice)
                    {
                        ++priceDiffer;
                        if (listing.SupplierPrice < r.price)
                        {
                            log   = "Prices differ -- NEED TO ADJUST - supplier price increased.";
                            body += log + "\n";
                            dsutil.DSUtil.WriteFile(log_file, log);
                        }
                        else
                        {
                            log   = "Prices differ";
                            body += log + "\n";
                            dsutil.DSUtil.WriteFile(log_file, log);
                        }

                        log   = string.Format("{0} {1}", listing.ListedItemID, listing.Title);
                        body += log + "\n";
                        dsutil.DSUtil.WriteFile(log_file, log);

                        log   = string.Format("CategoryID: {0}", listing.CategoryID);
                        body += log + "\n";
                        dsutil.DSUtil.WriteFile(log_file, log);

                        log   = string.Format("last price: {0}", r.price);
                        body += log + "\n";
                        dsutil.DSUtil.WriteFile(log_file, log);

                        log   = string.Format("recorded supplier price: {0}", listing.SupplierPrice);
                        body += log + "\n";
                        dsutil.DSUtil.WriteFile(log_file, log);

                        log   = string.Format("{0}", listing.SourceUrl);
                        body += log + "\n";
                        dsutil.DSUtil.WriteFile(log_file, log);

                        log   = string.Empty;
                        body += log + "\n\n";
                        dsutil.DSUtil.WriteFile(log_file, log);
                    }
                }
                catch (Exception exc)
                {
                    dsutil.DSUtil.WriteFile(log_file, string.Format("{0} {1}", listing.ListedItemID, listing.Title));
                    dsutil.DSUtil.WriteFile(log_file, string.Format("{0}", exc.Message));
                }
            }
            if (!string.IsNullOrEmpty(body))
            {
                DSUtil.SendMailDev("*****@*****.**", subject, body);
            }

            string msg = string.Format("found {0} different prices.", priceDiffer);

            return(msg);
        }
        public DataSet GetSPCModelVersionData(string modelConfigRawid, string version, bool isATT)
        {
            DataSet dsReturn = new DataSet();

            DataSet       dsTemp        = null;
            StringBuilder sb            = new StringBuilder();
            LinkedList    llstCondition = new LinkedList();

            string modelMstTblName          = string.Empty;
            string modelConfigMstTblName    = string.Empty;
            string modelConfigMsthTblName   = string.Empty;
            string modelConfigOptMstTblname = string.Empty;
            string modelContextMstTblname   = string.Empty;
            string modelRuleMstTblName      = string.Empty;
            string modelRuleMsthTblName     = string.Empty;
            string modelRuleOptMstTblName   = string.Empty;
            string modelRuleOptMsthTblName  = string.Empty;
            string modelAutoCalcMstTblname  = string.Empty;
            string modelAutoCalcMsthTblName = string.Empty;
            string ruleMstTblName           = string.Empty;
            string ruleOptMstTblName        = string.Empty;

            if (isATT)
            {
                modelMstTblName          = TABLE.MODEL_ATT_MST_SPC;
                modelConfigMstTblName    = TABLE.MODEL_CONFIG_ATT_MST_SPC;
                modelConfigMsthTblName   = TABLE.MODEL_CONFIG_ATT_MSTH_SPC;
                modelConfigOptMstTblname = TABLE.MODEL_CONFIG_OPT_ATT_MST_SPC;
                modelContextMstTblname   = TABLE.MODEL_CONTEXT_ATT_MST_SPC;
                modelRuleMstTblName      = TABLE.MODEL_RULE_ATT_MST_SPC;
                modelRuleMsthTblName     = TABLE.MODEL_RULE_ATT_MSTH_SPC;
                modelRuleOptMstTblName   = TABLE.MODEL_RULE_OPT_ATT_MST_SPC;
                modelRuleOptMsthTblName  = TABLE.MODEL_RULE_OPT_ATT_MSTH_SPC;
                modelAutoCalcMstTblname  = TABLE.MODEL_AUTOCALC_ATT_MST_SPC;
                modelAutoCalcMsthTblName = TABLE.MODEL_AUTOCALC_ATT_MSTH_SPC;
                ruleMstTblName           = TABLE.RULE_ATT_MST_SPC;
                ruleOptMstTblName        = TABLE.RULE_OPT_ATT_MST_SPC;
            }
            else
            {
                modelMstTblName          = TABLE.MODEL_MST_SPC;
                modelConfigMstTblName    = TABLE.MODEL_CONFIG_MST_SPC;
                modelConfigMsthTblName   = TABLE.MODEL_CONFIG_MSTH_SPC;
                modelConfigOptMstTblname = TABLE.MODEL_CONFIG_OPT_MST_SPC;
                modelContextMstTblname   = TABLE.MODEL_CONTEXT_MST_SPC;
                modelRuleMstTblName      = TABLE.MODEL_RULE_MST_SPC;
                modelRuleMsthTblName     = TABLE.MODEL_RULE_MSTH_SPC;
                modelRuleOptMstTblName   = TABLE.MODEL_RULE_OPT_MST_SPC;
                modelRuleOptMsthTblName  = TABLE.MODEL_RULE_OPT_MSTH_SPC;
                modelAutoCalcMstTblname  = TABLE.MODEL_AUTOCALC_MST_SPC;
                modelAutoCalcMsthTblName = TABLE.MODEL_AUTOCALC_MSTH_SPC;
                ruleMstTblName           = TABLE.RULE_MST_SPC;
                ruleOptMstTblName        = TABLE.RULE_OPT_MST_SPC;
            }

            try
            {
                llstCondition.Add("MODEL_CONFIG_RAWID", modelConfigRawid);
                llstCondition.Add("VERSION", version);

                //#00. MODEL_MST_SPC
                string query =
                    "SELECT * " +
                    " FROM " + modelMstTblName +
                    " WHERE RAWID IN (SELECT MODEL_RAWID " +
                    "                 FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                    "                       FROM " + modelConfigMsthTblName + " a " +
                    "                       WHERE Rawid = :MODEL_CONFIG_RAWID " +
                    "                       AND version = :VERSION) " +
                    "                 WHERE RNK = 1) ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = dsTemp.Tables[0].Copy();
                    dtConfig.TableName = modelMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }


                //#01. MODEL_CONFIG_MST_SPC

                //2009-12-07 bskwon 수정
                if (isATT)
                {
                    query =
                        "SELECT mcms.* " +
                        " FROM (SELECT * FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "       FROM MODEL_CONFIG_ATT_MSTH_SPC a " +
                        "       WHERE Rawid = :MODEL_CONFIG_RAWID " +
                        "       AND version = :VERSION) " +
                        " WHERE RNK = 1) mcms " +
                        " ORDER BY mcms.RAWID";
                }
                else
                {
                    query =
                        "SELECT mcms.*, B.NAME AS PARAM_TYPE, cc.name as MANAGE_TYPE_NAME " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONFIG_MSTH_SPC a " +
                        "             WHERE Rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1) mcms " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY = 'SPC_PARAM_TYPE') B " +
                        "                   ON mcms.PARAM_TYPE_CD = B.CODE " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY='SPC_MANAGE_TYPE') cc " +
                        "                   ON mcms.manage_type_cd = cc.code " +
                        " ORDER BY mcms.RAWID";
                }

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = dsTemp.Tables[0].Copy();
                    dtConfig.TableName = modelConfigMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }


                //#02. MODEL_CONFIG_OPT_MST_SPC
                if (isATT)
                {
                    query =
                        "SELECT A.* " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONFIG_OPT_ATT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1) A ";
                }
                else
                {
                    query =
                        "SELECT A.*, B.NAME AS SPC_PARAM_CATEGORY, C.NAME AS SPC_PRIORITY " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONFIG_OPT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1) A " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY = 'SPC_PARAM_CATEGORY') B " +
                        "                   ON (A.SPC_PARAM_CATEGORY_CD = B.CODE) " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY = 'SPC_PRIOTIRY') C " +
                        "                   ON (A.SPC_PRIORITY_CD = C.CODE) ";
                }

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfigOPT = dsTemp.Tables[0].Copy();
                    dtConfigOPT.TableName = modelConfigOptMstTblname;

                    dsReturn.Tables.Add(dtConfigOPT);
                }


                //#03. MODEL_CONTEXT_MST_SPC
                if (isATT)
                {
                    query =
                        "SELECT mcms.* " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONTEXT_ATT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1 ) mcms " +
                        " ORDER BY mcms.KEY_ORDER ASC ";
                }
                else
                {
                    query =
                        "SELECT mcms.*, aa.name as context_key_name " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONTEXT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1 ) mcms, " +
                        "      (SELECT CODE,NAME " +
                        "       FROM code_mst_pp " +
                        "       WHERE category='CONTEXT_TYPE' " +
                        "             UNION SELECT CODE,NAME " +
                        "             FROM code_mst_pp " +
                        "             WHERE category='SPC_CONTEXT_TYPE') AA " +
                        " WHERE mcms.context_key = aa.code " +
                        " ORDER BY mcms.KEY_ORDER ASC ";
                }

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtContext = dsTemp.Tables[0].Copy();
                    dtContext.TableName = modelContextMstTblname;

                    dsReturn.Tables.Add(dtContext);
                }

                //#04. MODEL_RULE_MST_SPC
                query =
                    "SELECT A.*, B.DESCRIPTION, " +
                    "       DECODE(A.USE_MAIN_SPEC_YN,'Y','True','N','False','True') AS USE_MAIN_SPEC, " +
                    "       '' AS RULE_OPTION, '' AS RULE_OPTION_DATA " +
                    " FROM (SELECT * " +
                    "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                    "             FROM " + modelRuleMsthTblName + " a " +
                    "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                    "             AND version = :VERSION ) " +
                    "       WHERE RNK = 1) A " +
                    "       LEFT OUTER JOIN " + ruleMstTblName + " B " +
                    "                   ON A.SPC_RULE_NO = B.SPC_RULE_NO ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtRule = dsTemp.Tables[0].Copy();
                    dtRule.TableName = modelRuleMstTblName;

                    dsReturn.Tables.Add(dtRule);
                }

                //#05. MODEL_RULE_OPT_MST_SPC
                query =
                    "SELECT b.*, c.option_name, c.description, a.spc_rule_no " +
                    " FROM (SELECT * " +
                    "       FROM (SELECT RANK () OVER (PARTITION BY VERSION ORDER BY input_dtts) rnk, aa.* " +
                    "             FROM " + modelRuleMsthTblName + " aa " +
                    "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                    "             AND VERSION = :VERSION) " +
                    "       WHERE rnk = 1) a " +
                    "       LEFT OUTER JOIN (SELECT * " +
                    "                        FROM (SELECT RANK () OVER (PARTITION BY VERSION ORDER BY input_dtts) rnk, aaa.* " +
                    "                              FROM " + modelRuleOptMsthTblName + " aaa " +
                    "                              WHERE model_rule_rawid IN (SELECT DISTINCT rawid " +
                    "                                                         FROM " + modelRuleMsthTblName +
                    "                                                         WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                    "                                                         AND VERSION = :VERSION) " +
                    "                              AND VERSION = :VERSION) " +
                    "                        WHERE rnk = 1) b " +
                    "                  ON (a.rawid = b.model_rule_rawid AND b.VERSION = :VERSION) " +
                    "       LEFT OUTER JOIN (SELECT a.rawid AS rule_rawid, a.spc_rule_no, " +
                    "                               b.rule_option_no, b.option_name, b.description " +
                    "                        FROM " + ruleMstTblName + " a " +
                    "                             LEFT OUTER JOIN " + ruleOptMstTblName + " b " +
                    "                                        ON (a.rawid = b.rule_rawid) ) c " +
                    "                  ON (a.spc_rule_no = c.spc_rule_no " +
                    "                      AND b.rule_option_no = c.rule_option_no) " +
                    " ORDER BY b.rawid ASC ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtRuleOPT = dsTemp.Tables[0].Copy();
                    dtRuleOPT.TableName = modelRuleOptMstTblName;

                    dsReturn.Tables.Add(dtRuleOPT);
                }

                //#06. MODEL_AUTOCALC_MST_SPC
                query =
                    "SELECT * " +
                    " FROM (SELECT * " +
                    "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                    "             FROM " + modelAutoCalcMsthTblName + " a " +
                    "             WHERE model_config_rawid = :model_config_rawid " +
                    "             AND version = :version) " +
                    "       WHERE RNK = 1) ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtAutoCalc = dsTemp.Tables[0].Copy();
                    dtAutoCalc.TableName = modelAutoCalcMstTblname;

                    dsReturn.Tables.Add(dtAutoCalc);
                }
            }
            catch (Exception ex)
            {
                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, new string[] { ex.Message, ex.Source, ex.StackTrace });
            }
            finally
            {
                //resource 해제
                if (dsTemp != null)
                {
                    dsTemp.Dispose();
                    dsTemp = null;
                }

                llstCondition.Clear();
                llstCondition = null;
            }

            return(dsReturn);
        }
示例#5
0
        private void ConfigListDataBinding(string _sSPCModelRawid)
        {
            try
            {
                LinkedList _llstSearchCondition = new LinkedList();
                DataSet    _dsSPCModeData       = new DataSet();

                string strParamAlias = "";
                //초기화
                _llstSearchCondition.Clear();
                _llstSearchCondition.Add(Definition.CONDITION_KEY_MODEL_RAWID, _sSPCModelRawid);


                EESProgressBar.ShowProgress(this, this._mlthandler.GetMessage(Definition.LOADING_DATA), true);

                AsyncCallHandler ach = new AsyncCallHandler(EESProgressBar.AsyncCallManager);

                object objDataSet = ach.SendWait(_ws, "GetSPCModelData", new object[] { _llstSearchCondition.GetSerialData() });

                EESProgressBar.CloseProgress(this);
                //

                if (objDataSet != null)
                {
                    _dsSPCModeData = (DataSet)objDataSet;
                }
                else
                {
                    MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA"));
                    return;
                }

                if (!DSUtil.CheckRowCount(_dsSPCModeData, TABLE.MODEL_MST_SPC))
                {
                    MSGHandler.DisplayMessage(MSGType.Information, "SPC_INFO_MODEL_ELIMINATED", null, null);
                    return;
                }

                DataTable dtConfig  = _dsSPCModeData.Tables[TABLE.MODEL_CONFIG_MST_SPC];
                DataTable dtContext = _dsSPCModeData.Tables[TABLE.MODEL_CONTEXT_MST_SPC];
                DataTable dtRuleMst = _dsSPCModeData.Tables[TABLE.MODEL_RULE_MST_SPC];

                EESProgressBar.ShowProgress(this, MSGHandler.GetMessage("PROCESS_LOADING_PAGE_DATA"), false);

                DataTable dtSPCModelChartList = new DataTable();

                dtSPCModelChartList.Columns.Add(COLUMN.SELECT, typeof(Boolean));
                dtSPCModelChartList.Columns.Add(COLUMN.CHART_ID);
                dtSPCModelChartList.Columns.Add(COLUMN.PARAM_ALIAS);
                dtSPCModelChartList.Columns.Add(COLUMN.MAIN_YN);
                dtSPCModelChartList.Columns.Add(COLUMN.VERSION);
                dtSPCModelChartList.Columns.Add("MODE");

                //CONTEXT COLUMN 생성
                DataRow[] drConfigs = dtConfig.Select(COLUMN.MAIN_YN + " = 'Y'", COLUMN.RAWID);

                if (drConfigs != null && drConfigs.Length > 0)
                {
                    DataRow[] drMainContexts = dtContext.Select(string.Format("{0} = '{1}'", COLUMN.MODEL_CONFIG_RAWID, drConfigs[0][COLUMN.RAWID]), COLUMN.KEY_ORDER);

                    foreach (DataRow drMainContext in drMainContexts)
                    {
                        dtSPCModelChartList.Columns.Add(drMainContext["CONTEXT_KEY_NAME"].ToString());
                    }
                }

                LinkedList llCondition = new LinkedList();
                llCondition.Add(Definition.CONDITION_KEY_CATEGORY, Definition.CODE_CATEGORY_CHART_MODE);
                DataSet _dsChartMode = this._ws.GetCodeData(llCondition.GetSerialData());

                Dictionary <string, string> modeCodeData = new Dictionary <string, string>();
                if (_dsChartMode != null && _dsChartMode.Tables.Count > 0)
                {
                    foreach (DataRow dr in _dsChartMode.Tables[0].Rows)
                    {
                        modeCodeData.Add(dr[COLUMN.CODE].ToString(), dr[COLUMN.NAME].ToString());
                    }
                }

                foreach (DataRow drConfig in dtConfig.Rows)
                {
                    DataRow drChartList = dtSPCModelChartList.NewRow();

                    drChartList[COLUMN.CHART_ID]    = drConfig[COLUMN.RAWID].ToString();
                    drChartList[COLUMN.PARAM_ALIAS] = drConfig[COLUMN.PARAM_ALIAS].ToString();
                    drChartList[COLUMN.MAIN_YN]     = drConfig[COLUMN.MAIN_YN].ToString();
                    //#Version이 Null 또는 Empty인 경우 대비 Check Logic 추가
                    if (!string.IsNullOrEmpty(drConfig[COLUMN.VERSION].ToString()))
                    {
                        drChartList[COLUMN.VERSION] = (1 + Convert.ToDouble(drConfig[COLUMN.VERSION].ToString()) / 100).ToString("N2");
                    }
                    string modeValue = drConfig[COLUMN.CHART_MODE_CD].ToString();
                    if (modeCodeData.ContainsKey(modeValue))
                    {
                        modeValue = modeCodeData[modeValue];
                    }
                    drChartList["MODE"] = modeValue;

                    if (strParamAlias == "")
                    {
                        strParamAlias = drConfig[COLUMN.PARAM_ALIAS].ToString();
                    }

                    DataRow[] drContexts = dtContext.Select(string.Format("{0} = '{1}'", COLUMN.MODEL_CONFIG_RAWID, drConfig[COLUMN.RAWID]));

                    foreach (DataRow drContext in drContexts)
                    {
                        //2009-11-27 bskwon 추가 : Sub Model 상속 구조가 아닌경우 예외처리
                        if (!dtSPCModelChartList.Columns.Contains(drContext["CONTEXT_KEY_NAME"].ToString()))
                        {
                            dtSPCModelChartList.Columns.Add(drContext["CONTEXT_KEY_NAME"].ToString());
                        }

                        drChartList[drContext["CONTEXT_KEY_NAME"].ToString()] = drContext[COLUMN.CONTEXT_VALUE].ToString();
                    }

                    dtSPCModelChartList.Rows.Add(drChartList);
                }

                dtSPCModelChartList.AcceptChanges();

                bsprData.ClearHead();
                bsprData.UseEdit      = true;
                bsprData.UseHeadColor = true;
                bsprData.Locked       = true;

                for (int i = 0; i < dtSPCModelChartList.Columns.Count; i++)
                {
                    string sColumn = dtSPCModelChartList.Columns[i].ColumnName.ToString();
                    if (i == 0)
                    {
                        this.bsprData.AddHead(i, sColumn, sColumn, 50, 20, null, null, null, ColumnAttribute.Null,
                                              ColumnType.CheckBox, null, null, null, false, true);
                    }
                    else
                    {
                        this.bsprData.AddHead(i, sColumn, sColumn, 100, 20, null, null, null, ColumnAttribute.Null,
                                              ColumnType.Null, null, null, null, false, true);
                    }
                }

                this.bsprData.AddHeadComplete();
                this.bsprData.DataSet = dtSPCModelChartList;

                this.bsprData.Locked = true;
                this.bsprData.ActiveSheet.Columns[0].Locked  = false;
                this.bsprData.ActiveSheet.Columns[2].Visible = false;



                this.bsprData.AllowNewRow = false;

                FarPoint.Win.Spread.CellType.TextCellType tc = new FarPoint.Win.Spread.CellType.TextCellType();
                tc.MaxLength = 1024;

                //Column Size 조절
                for (int cIdx = 0; cIdx < this.bsprData.ActiveSheet.Columns.Count; cIdx++)
                {
                    this.bsprData.ActiveSheet.Columns[cIdx].Width = this.bsprData.ActiveSheet.Columns[cIdx].GetPreferredWidth();

                    if (this.bsprData.ActiveSheet.Columns[cIdx].Width > 150)
                    {
                        this.bsprData.ActiveSheet.Columns[cIdx].Width = 150;
                    }

                    if (this.bsprData.ActiveSheet.Columns[cIdx].CellType != null &&
                        this.bsprData.ActiveSheet.Columns[cIdx].CellType.GetType() == typeof(FarPoint.Win.Spread.CellType.TextCellType))
                    {
                        this.bsprData.ActiveSheet.Columns[cIdx].CellType = tc;
                    }
                }

                //MAIN은 첫번째 ROW에 배치하고 ROW HIGHLIGHT
                if (this.bsprData.GetCellText(0, 3).Equals("Y"))
                {
                    this.bsprData.ActiveSheet.Rows[0].BackColor = Color.LightGreen; //Color.LemonChiffon;
                }

                this.bsprData.LeaveCellAction();
            }
            catch (Exception ex)
            {
                EESProgressBar.CloseProgress(this);
                if (ex is OperationCanceledException || ex is TimeoutException)
                {
                    MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true);
                }
                else
                {
                    LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
                    MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true);
                }
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
            }
            finally
            {
                EESProgressBar.CloseProgress(this);
            }
        }
示例#6
0
 protected Tree()
 {
     Util  = new DSUtil();
     Root  = null;
     Index = 0;
 }
示例#7
0
        public override void PageSearch(LinkedList llCondition)
        {
            try
            {
                if (llCondition[Definition.DynamicCondition_Search_key.SPCMODEL] == null ||
                    ((DataTable)llCondition[Definition.DynamicCondition_Search_key.SPCMODEL]).Rows.Count == 0)
                {
                    InitializePage();
                    return;
                }

                lastestCondition = llCondition;

                DataTable     spcmodels   = (DataTable)llCondition[Definition.DynamicCondition_Search_key.SPCMODEL];
                List <string> modelRawids = new List <string>();
                foreach (DataRow dr in spcmodels.Rows)
                {
                    modelRawids.Add(dr[Definition.CONDITION_SEARCH_KEY_VALUEDATA].ToString());
                }

                //DataSet ds = this.controller.GetModelData(modelRawids.ToArray());

                EESProgressBar.ShowProgress(this, this._lang.GetMessage(Definition.LOADING_DATA), true);

                AsyncCallHandler ach = new AsyncCallHandler(EESProgressBar.AsyncCallManager);

                object objDataSet = ach.SendWait(_ws, "GetSPCModelsData", new object[] { modelRawids.ToArray(), _bUseComma });

                EESProgressBar.CloseProgress(this);
                //


                if (objDataSet != null)
                {
                    _ds = (DataSet)objDataSet;
                }
                else
                {
                    MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA"));
                    return;
                }

                EESProgressBar.ShowProgress(this, MSGHandler.GetMessage("PROCESS_LOADING_PAGE_DATA"), false);
                //DataSet ds = _ws.GetSPCModelsData(modelRawids.ToArray());

                spcModels = new Dictionary <string, SPCModel>();

                foreach (DataRow dr in _ds.Tables[TABLE.MODEL_MST_SPC].Rows)
                {
                    SPCModel spcModel = new SPCModel
                    {
                        SPCModelRawID = dr[COLUMN.RAWID].ToString(),
                        SPCModelName  = dr[COLUMN.SPC_MODEL_NAME].ToString(),
                    };
                    spcModels.Add(spcModel.SPCModelRawID, spcModel);
                }

                foreach (var kvp in spcModels)
                {
                    DataRow[] drs = _ds.Tables[TABLE.MODEL_CONFIG_MST_SPC].Select(COLUMN.MODEL_RAWID + " = '" + kvp.Key + "'");
                    if (drs.Length == 0)
                    {
                        continue;
                    }

                    kvp.Value.ParamType = drs[0][COLUMN.PARAM_TYPE_CD].ToString();

                    kvp.Value.SubModels = new List <SPCModel>();

                    foreach (DataRow dr in drs)
                    {
                        if (dr[COLUMN.MAIN_YN].ToString().ToUpper() == "Y")
                        {
                            kvp.Value.ChartID     = dr[COLUMN.RAWID].ToString();
                            kvp.Value.Version     = dr[COLUMN.VERSION].ToString();
                            kvp.Value.IsMainModel = true;
                            continue;
                        }

                        SPCModel spcModel = new SPCModel
                        {
                            ChartID       = dr[COLUMN.RAWID].ToString(),
                            SPCModelRawID = kvp.Value.SPCModelRawID,
                            SPCModelName  = kvp.Value.SPCModelName,
                            Version       = dr[COLUMN.VERSION].ToString(),
                            IsMainModel   = false,
                            ParamType     = kvp.Value.ParamType
                        };
                        kvp.Value.SubModels.Add(spcModel);
                    }
                }


                if (DSUtil.GetResultInt(_ds) != 0)
                {
                    MSGHandler.DisplayMessage(MSGType.Error, DSUtil.GetResultMsg(_ds));
                    InitializePage();
                    return;
                }

                BindingSpread();
            }
            catch (Exception ex)
            {
                EESProgressBar.CloseProgress(this);
                if (ex is OperationCanceledException || ex is TimeoutException)
                {
                    MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true);
                }
                else
                {
                    LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
                    MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true);
                }
                //this.MsgClose();
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
            }
            finally
            {
                EESProgressBar.CloseProgress(this);
            }
        }
示例#8
0
        public DataSet GetSPCModelsData(string[] modelRawids, bool useComma, bool isATT)
        {
            DataSet dsReturn = new DataSet();

            string modelMstTblName        = string.Empty;
            string modelConfigMstTblName  = string.Empty;
            string modelContextMstTblName = string.Empty;
            string modelRuleMstTblName    = string.Empty;
            string ruleMstTblName         = string.Empty;

            if (isATT)
            {
                modelMstTblName        = TABLE.MODEL_ATT_MST_SPC;
                modelConfigMstTblName  = TABLE.MODEL_CONFIG_ATT_MST_SPC;
                modelContextMstTblName = TABLE.MODEL_CONTEXT_ATT_MST_SPC;
                modelRuleMstTblName    = TABLE.MODEL_RULE_ATT_MST_SPC;
                ruleMstTblName         = TABLE.RULE_ATT_MST_SPC;
            }
            else
            {
                modelMstTblName        = TABLE.MODEL_MST_SPC;
                modelConfigMstTblName  = TABLE.MODEL_CONFIG_MST_SPC;
                modelContextMstTblName = TABLE.MODEL_CONTEXT_MST_SPC;
                modelRuleMstTblName    = TABLE.MODEL_RULE_MST_SPC;
                ruleMstTblName         = TABLE.RULE_MST_SPC;
            }

            try
            {
                DataSet       temp = new DataSet();
                StringBuilder sb   = new StringBuilder();

                //#00. MODEL_MST_SPC
                sb.Append("SELECT rawid, spc_model_name FROM ");
                sb.Append(modelMstTblName);
                sb.Append(" WHERE 1 = 1 ");

                for (int i = 0; i < modelRawids.Length; i++)
                {
                    if (i == 0)
                    {
                        sb.Append(" and ((");
                    }
                    else
                    {
                        sb.Append(" or (");
                    }
                    sb.Append("RAWID = '" + modelRawids[i] + "')");
                }
                sb.Append(") order by rawid");

                temp = this.Query(sb.ToString());

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = temp.Tables[0].Copy();
                    dtConfig.TableName = modelMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }

                //#01. MODEL_CONFIG_MST_SPC
                sb.Remove(0, sb.Length);

                if (isATT)
                {
                    sb.Append(@"SELECT rawid, model_rawid, MAIN_YN, CHART_MODE_CD,  VERSION
                                FROM model_config_att_mst_spc WHERE 1 = 1 ");
                }
                else
                {
                    sb.Append(@"SELECT rawid, model_rawid, MAIN_YN, CHART_MODE_CD, PARAM_TYPE_CD, VERSION
                                FROM model_config_mst_spc WHERE 1 = 1 ");
                }

                for (int i = 0; i < modelRawids.Length; i++)
                {
                    if (i == 0)
                    {
                        sb.Append(" and ((");
                    }
                    else
                    {
                        sb.Append(" or (");
                    }
                    sb.Append("MODEL_RAWID = '" + modelRawids[i] + "')");
                }
                sb.Append(")");
                sb.Append(" ORDER BY model_rawid, RAWID");

                temp = this.Query(sb.ToString());

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = temp.Tables[0].Copy();
                    dtConfig.TableName = modelConfigMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }

                //#02. MODEL_CONTEXT_MST_SPC
                sb.Remove(0, sb.Length);
                sb.Append("SELECT mcms.rawid, mcms.model_config_rawid, mcms.context_key,  ");

                if (useComma)
                {
                    sb.Append("   replace(mcms.context_value, ';', ',') as context_value, ");
                }
                else
                {
                    sb.Append("   mcms.context_value, ");
                }

                sb.Append("       mcms.exclude_list, mcms.key_order, mcms.create_dtts, mcms.create_by, mcms.last_update_dtts, ");
                sb.Append("       mcms.last_update_by, mcms.group_yn, mcms.version, aa.name AS context_key_name ");
                sb.Append(" FROM " + modelContextMstTblName + " mcms, ");
                sb.Append("   (SELECT code, NAME ");
                sb.Append("     FROM code_mst_pp ");
                sb.Append("     WHERE CATEGORY = 'CONTEXT_TYPE'   ");
                sb.Append("     UNION                                      ");
                sb.Append("    SELECT code, NAME ");
                sb.Append("     FROM code_mst_pp               ");
                sb.Append("     WHERE CATEGORY = 'SPC_CONTEXT_TYPE') aa   ");
                sb.Append(" WHERE mcms.context_key = aa.code                  ");
                sb.Append(" AND mcms.model_config_rawid IN (SELECT rawid    ");
                sb.Append("                                 FROM " + modelConfigMstTblName + " ");
                sb.Append("                                 WHERE 1=1 ");

                for (int i = 0; i < modelRawids.Length; i++)
                {
                    if (i == 0)
                    {
                        sb.Append(" AND ((");
                    }
                    else
                    {
                        sb.Append(" OR (");
                    }
                    sb.Append("MODEL_RAWID = '" + modelRawids[i] + "')");
                }
                sb.Append(")");
                sb.Append(") ORDER BY mcms.key_order ASC");

                temp = this.Query(sb.ToString());

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = temp.Tables[0].Copy();
                    dtConfig.TableName = modelContextMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }

                //#03. MODEL_RULE_MST_SPC
                sb.Remove(0, sb.Length);
                sb.Append(@"SELECT a.*, b.description,
                                   DECODE (a.use_main_spec_yn,
                                           'Y', 'True',
                                           'N', 'False',
                                           'True'
                                          ) AS use_main_spec,
                                   '' AS rule_option, '' AS rule_option_data
                              FROM " + modelRuleMstTblName + " a LEFT OUTER JOIN " + ruleMstTblName + @" b
                                   ON a.spc_rule_no = b.spc_rule_no
                             WHERE 1 = 1 AND a.model_config_rawid IN (SELECT rawid
                                                                        FROM " + modelConfigMstTblName +
                          " WHERE 1=1 ");

                for (int i = 0; i < modelRawids.Length; i++)
                {
                    if (i == 0)
                    {
                        sb.Append(" and ((");
                    }
                    else
                    {
                        sb.Append(" or (");
                    }
                    sb.Append("MODEL_RAWID = '" + modelRawids[i] + "')");
                }
                sb.Append(") )");

                temp = this.Query(sb.ToString());

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = temp.Tables[0].Copy();
                    dtConfig.TableName = modelRuleMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }
            }
            catch (Exception ex)
            {
                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, new string[] { ex.Message, ex.Source, ex.StackTrace });
            }

            return(dsReturn);
        }
示例#9
0
        public DataSet CopyModelInfo(byte[] param)
        {
            DataSet dsReturn = null;

            try
            {
                BISTel.eSPC.Data.Server.Modeling.SPCModelData spcModelData = new BISTel.eSPC.Data.Server.Modeling.SPCModelData();
                spcModelData.ParentSQLHandler = this;

                LinkedList llstTotalConfigInfo = new LinkedList();
                LinkedList llstParam           = null;
                llstTotalConfigInfo.SetSerialData(param);

                ArrayList arrMainTargetRawid = new ArrayList();
                ArrayList arrSubTargetRawid  = new ArrayList();

                base.BeginTrans();

                for (int i = 0; i < llstTotalConfigInfo.Count; i++)
                {
                    llstParam = (LinkedList)llstTotalConfigInfo[i];

                    string sUserID = llstParam[Definition.DynamicCondition_Condition_key.USER_ID].ToString();

                    string sourceConfigRawID = llstParam[Definition.COPY_MODEL.SOURCE_MODEL_CONFIG_RAWID].ToString();
                    string targetConfigRawID = llstParam[Definition.COPY_MODEL.TARGET_MODEL_CONFIG_RAWID].ToString();
                    string mainYN            = llstParam[Definition.CONDITION_KEY_MAIN_YN].ToString();

                    if (mainYN == "Y")
                    {
                        arrMainTargetRawid.Add(targetConfigRawID);
                    }
                    else
                    {
                        arrSubTargetRawid.Add(targetConfigRawID);
                    }

                    bool hasSubconfigs = Convert.ToBoolean(llstParam[Definition.CONDITION_KEY_HAS_SUBCONFIG].ToString());

                    dsReturn = spcModelData.CopyModelInfo(llstParam);

                    if (base.ErrorMessage.Length > 0 || DSUtil.GetResultSucceed(dsReturn) == 0)
                    {
                        this.RollBack();
                        return(dsReturn);
                    }
                }

                //modified by enkim Gemini P3-3816
                //string subConfigRawIDs = "";
                //if (mainYN.Equals(Definition.VARIABLE_Y) && hasSubconfigs)
                //{
                //    dsReturn = spcModelData.ModifySPCSubModelForCopy(llstParam, ref subConfigRawIDs);
                //    if (subConfigRawIDs.Length > 0)
                //    {
                //        subConfigRawIDs = subConfigRawIDs.Substring(1);
                //    }
                //}

                //modified end

                this.Commit();

                if (arrMainTargetRawid.Count > 0)
                {
                    LinkedList llstCondition = new LinkedList();
                    llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, arrMainTargetRawid[0].ToString());
                    llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, "Y");
                    llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "update");
                    llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[COLUMN.USER_ID].ToString());

                    //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                    Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                    msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                }
                if (arrSubTargetRawid.Count > 0)
                {
                    string subConfigRawIDs = "";

                    for (int i = 0; i < arrSubTargetRawid.Count; i++)
                    {
                        subConfigRawIDs += ";" + arrSubTargetRawid[i].ToString();
                    }

                    if (subConfigRawIDs.Length > 0)
                    {
                        subConfigRawIDs = subConfigRawIDs.Substring(1);
                        LinkedList llstCondition = new LinkedList();
                        llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, subConfigRawIDs);
                        llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, "N");
                        llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "update");
                        llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[COLUMN.USER_ID].ToString());

                        //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                        Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                        msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                    }
                }



                //modified by enkim Gemini P3-3816

                //if (mainYN.Equals(Definition.VARIABLE_Y) && hasSubconfigs)
                //{
                //    llstCondition = new LinkedList();
                //    llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, subConfigRawIDs);
                //    llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_N);
                //    llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "update");

                //    //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                //    msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                //    msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                //}

                //modified end
            }
            catch (Exception ex)
            {
                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
                base.RollBack();
            }
            finally
            {
                this.Close();
            }

            return(dsReturn);
        }
示例#10
0
        public DataSet SaveSPCModelData(byte[] param)
        {
            string configRawID = "";

            DataSet dsReturn = new DataSet();

            bool   _isGroup     = false;
            string comment      = "";
            string changedItems = "";
            string groupRawid   = null;

            try
            {
                BISTel.eSPC.Data.Server.Modeling.SPCModelData spcModelData = new BISTel.eSPC.Data.Server.Modeling.SPCModelData();
                spcModelData.ParentSQLHandler = this;

                LinkedList llstParam = new LinkedList();
                llstParam.SetSerialData(param);

                bool useComma = false;

                if (llstParam[Definition.VARIABLE_USE_COMMA] is bool)
                {
                    useComma = (bool)llstParam[Definition.VARIABLE_USE_COMMA];
                }

                string     sUserID    = llstParam[Definition.CONDITION_KEY_USER_ID].ToString();
                ConfigMode configMode = (ConfigMode)llstParam[Definition.CONDITION_KEY_CONFIG_MODE];

                DataTable dtModel     = (DataTable)llstParam[TABLE.MODEL_MST_SPC];
                DataTable dtConfig    = (DataTable)llstParam[TABLE.MODEL_CONFIG_MST_SPC];
                DataTable dtConfigOpt = (DataTable)llstParam[TABLE.MODEL_CONFIG_OPT_MST_SPC];
                DataTable dtContext   = (DataTable)llstParam[TABLE.MODEL_CONTEXT_MST_SPC];
                DataTable dtRule      = (DataTable)llstParam[TABLE.MODEL_RULE_MST_SPC];
                DataTable dtRuleOpt   = (DataTable)llstParam[TABLE.MODEL_RULE_OPT_MST_SPC];
                DataTable dtAutoCalc  = (DataTable)llstParam[TABLE.MODEL_AUTOCALC_MST_SPC];

                string _sMainYN        = "";
                string sConfigRawid    = "";
                string srefConfigRawid = "";
                bool   bOnlyMain       = false;
                bool   bOnlyMainGroup  = false;

                if (llstParam[Definition.CONDITION_KEY_MAIN_YN] != null)
                {
                    _sMainYN = llstParam[Definition.CONDITION_KEY_MAIN_YN].ToString();
                }

                bool _hasSubconfigs = Convert.ToBoolean(llstParam[Definition.CONDITION_KEY_HAS_SUBCONFIG].ToString());

                if (llstParam.Contains(COLUMN.GROUP_YN))
                {
                    _isGroup = true;
                }

                if (llstParam.Contains(COLUMN.GROUP_RAWID))
                {
                    groupRawid = llstParam[COLUMN.GROUP_RAWID].ToString();
                }

                base.BeginTrans();

                switch (configMode)
                {
                case ConfigMode.CREATE_MAIN:
                case ConfigMode.SAVE_AS:
                case ConfigMode.CREATE_MAIN_FROM:
                    dsReturn = spcModelData.CreateSPCModel(configMode, sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, ref srefConfigRawid, groupRawid, useComma);
                    break;

                case ConfigMode.CREATE_SUB:
                    dsReturn = spcModelData.CreateSPCModel(configMode, sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, ref srefConfigRawid, groupRawid, useComma);
                    break;

                case ConfigMode.MODIFY:
                case ConfigMode.ROLLBACK:
                    if (llstParam.Contains(COLUMN.SAVE_COMMENT))
                    {
                        comment = llstParam[COLUMN.SAVE_COMMENT].ToString();
                    }
                    if (llstParam.Contains(COLUMN.CHANGED_ITEMS))
                    {
                        changedItems = llstParam[COLUMN.CHANGED_ITEMS].ToString();
                    }
                    List <string> lstChangedMasterColList = (List <string>)llstParam["CHANGED_MASTER_COL_LIST"];
                    dsReturn = spcModelData.ModifySPCModel(sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, lstChangedMasterColList, comment, changedItems, groupRawid, useComma);
                    break;

                case ConfigMode.DEFAULT:
                    dsReturn = spcModelData.SaveDefaultConfig(sUserID, dtModel, dtConfig, dtConfigOpt, dtContext, dtRule, dtRuleOpt, dtAutoCalc, useComma);
                    break;
                }

                if (base.ErrorMessage.Length > 0 || DSUtil.GetResultSucceed(dsReturn) == 0)
                {
                    this.RollBack();
                    return(dsReturn);
                }

                if (configMode.Equals(ConfigMode.MODIFY) || configMode.Equals(ConfigMode.ROLLBACK))
                {
                    configRawID = dtConfig.Rows[0][COLUMN.RAWID].ToString();
                }

                if ((configMode.Equals(ConfigMode.MODIFY) || configMode.Equals(ConfigMode.ROLLBACK)) && _sMainYN.Equals(Definition.VARIABLE_Y) &&
                    _hasSubconfigs)
                {
                    if (llstParam.Contains("ONLY_MAIN"))
                    {
                        if (llstParam["ONLY_MAIN"].ToString() == Definition.VARIABLE_Y)
                        {
                            bOnlyMain = true;
                        }
                    }
                    if (llstParam.Contains("ONLY_MAIN_GROUP"))
                    {
                        if (llstParam["ONLY_MAIN_GROUP"].ToString() == Definition.VARIABLE_Y)
                        {
                            bOnlyMainGroup = true;
                        }
                    }
                    if (!bOnlyMain)
                    {
                        dsReturn = spcModelData.ModifySPCSubModel(configRawID, dtRule, dtRuleOpt, sUserID, ref sConfigRawid);

                        if (sConfigRawid.Length > 0)
                        {
                            sConfigRawid = sConfigRawid.Substring(1);
                        }
                    }

                    dsReturn = spcModelData.ModifySPCSubModelContext(configRawID, dtContext, sUserID, bOnlyMainGroup, groupRawid);

                    if (_isGroup) //기존 Sub 전체 삭제.
                    {
                        bool bResult = spcModelData.DeleteSPCModelConfig(sConfigRawid);
                        if (!bResult)
                        {
                            base.RollBack();
                        }
                    }
                }

                this.Commit();

                // Increase version
                CommonData commonData = new CommonData();
                switch (configMode)
                {
                case ConfigMode.CREATE_MAIN:
                case ConfigMode.CREATE_MAIN_FROM:
                case ConfigMode.SAVE_AS:
                case ConfigMode.CREATE_SUB:
                    this.BeginTrans();
                    foreach (string query in commonData.GetIncreaseVersionQuery(srefConfigRawid.ToString()))
                    {
                        this.Query(query);
                    }
                    this.Commit();
                    break;

                case ConfigMode.MODIFY:
                case ConfigMode.ROLLBACK:
                    this.BeginTrans();
                    foreach (DataRow dr in dtConfig.Rows)
                    {
                        foreach (string query in commonData.GetIncreaseVersionQuery(dr[COLUMN.RAWID].ToString()))
                        {
                            this.Query(query);
                        }
                    }

                    if (!bOnlyMain && _sMainYN.Equals(Definition.VARIABLE_Y) && _hasSubconfigs)
                    {
                        //modified by enkim 2012.05.18 SPC-739
                        //IncreaseVersionOfSubConfigs(sConfigRawid.Split(';'));
                        bool bResultTmp = spcModelData.IncreaseVersionOfSubConfigs(configRawID);
                        //modified end SPC-739
                    }
                    this.Commit();
                    break;
                }

                if (configMode.Equals(ConfigMode.MODIFY) || configMode.Equals(ConfigMode.ROLLBACK))
                {
                    LinkedList llstCondition = new LinkedList();
                    llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, configRawID);
                    llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, _sMainYN);
                    llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "update");
                    llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[COLUMN.USER_ID].ToString());

                    //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                    Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                    msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                }

                if ((configMode.Equals(ConfigMode.MODIFY) || configMode.Equals(ConfigMode.ROLLBACK)) && _sMainYN.Equals(Definition.VARIABLE_Y) && _hasSubconfigs)
                {
                    if (!_isGroup)
                    {
                        if (!bOnlyMain)
                        {
                            LinkedList llstCondition = new LinkedList();
                            llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, sConfigRawid);
                            llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_N);
                            llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "update");
                            llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[COLUMN.USER_ID].ToString());

                            //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                            Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                            msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                        }
                    }
                    else
                    {
                        if (!bOnlyMain)
                        {
                            LinkedList llstCondition = new LinkedList();
                            llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, sConfigRawid);
                            llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_N);
                            llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "remove");
                            llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[COLUMN.USER_ID].ToString());

                            //수정했을 경우 Server로 변경에 대한 Inform을 준다.
                            Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                            msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                        }
                    }
                }

                if (configMode.Equals(ConfigMode.CREATE_MAIN) || configMode.Equals(ConfigMode.SAVE_AS) || configMode.Equals(ConfigMode.CREATE_MAIN_FROM))
                {
                    if (srefConfigRawid.Length > 0)
                    {
                        LinkedList llstCondition = new LinkedList();
                        llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, srefConfigRawid);
                        llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_Y);
                        llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "add");
                        llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[COLUMN.USER_ID].ToString());
                        Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                        msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                    }
                }

                if (configMode.Equals(ConfigMode.CREATE_SUB))
                {
                    if (srefConfigRawid.Length > 0)
                    {
                        LinkedList llstCondition = new LinkedList();
                        llstCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, srefConfigRawid);
                        llstCondition.Add(Definition.CONDITION_KEY_MAIN_YN, Definition.VARIABLE_N);
                        llstCondition.Add(Definition.CONDITION_KEY_FUNCTION, "add");
                        llstCondition.Add(Definition.CONDITION_KEY_USER_ID, llstParam[COLUMN.USER_ID].ToString());
                        Interface.MsgInterfaceBusiness msgBussiness = new BISTel.eSPC.Business.Server.Interface.MsgInterfaceBusiness();
                        msgBussiness.SetSPCModel(llstCondition.GetSerialData());
                    }
                }
            }
            catch (Exception ex)
            {
                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
                base.RollBack();
            }
            finally
            {
                this.Close();
            }

            return(dsReturn);
        }
示例#11
0
        private void ConfigListDataBinding()
        {
            string strParamAlias = "";

            //초기화
            _llstSearchCondition.Clear();
            _llstSearchCondition.Add(Definition.CONDITION_KEY_MODEL_RAWID, this._sSPCModelRawid);
            _llstSearchCondition.Add(Definition.VARIABLE_USE_COMMA, _bUseComma);

            _dsSPCModeData         = _wsSPC.GetSPCModelData(_llstSearchCondition.GetSerialData());
            this._dsSPCProductData = _wsSPC.GetProductIDMappingData();

            if (!DSUtil.CheckRowCount(_dsSPCModeData, TABLE.MODEL_MST_SPC))
            {
                MSGHandler.DisplayMessage(MSGType.Information, "SPC_INFO_ALREADY_ELIMINATED", new string[] { _sSPCModelName }, null);
                return;
            }

            DataTable dtConfig  = _dsSPCModeData.Tables[TABLE.MODEL_CONFIG_MST_SPC];
            DataTable dtContext = _dsSPCModeData.Tables[TABLE.MODEL_CONTEXT_MST_SPC];
            DataTable dtRuleMst = _dsSPCModeData.Tables[TABLE.MODEL_RULE_MST_SPC];

            //#01. SPC Model Chart List를 위한 Datatable 생성
            DataTable dtSPCModelChartList = new DataTable();

            dtSPCModelChartList.Columns.Add(COLUMN.RAWID);
            dtSPCModelChartList.Columns.Add(COLUMN.PARAM_ALIAS);
            dtSPCModelChartList.Columns.Add(COLUMN.MAIN_YN);

            //CONTEXT COLUMN 생성
            DataRow[] drConfigs = dtConfig.Select(COLUMN.MAIN_YN + " = 'Y'", COLUMN.RAWID);

            if (drConfigs != null && drConfigs.Length > 0)
            {
                DataRow[] drMainContexts = dtContext.Select(string.Format("{0} = '{1}'", COLUMN.MODEL_CONFIG_RAWID, drConfigs[0][COLUMN.RAWID]), COLUMN.KEY_ORDER);

                foreach (DataRow drMainContext in drMainContexts)
                {
                    dtSPCModelChartList.Columns.Add(drMainContext["CONTEXT_KEY_NAME"].ToString());
                }
            }

            //2009-12-08 dkshin 추가 : CREATE_BY, CREATE_TIME COLUMN
            dtSPCModelChartList.Columns.Add(COLUMN.CREATE_BY);
            dtSPCModelChartList.Columns.Add(COLUMN.CREATE_DTTS);

            //#02. CONFIG MST에 생성된 CONTEXT COLUMN에 Data 입력
            foreach (DataRow drConfig in dtConfig.Rows)
            {
                DataRow drChartList = dtSPCModelChartList.NewRow();

                drChartList[COLUMN.RAWID]       = drConfig[COLUMN.RAWID].ToString();
                drChartList[COLUMN.PARAM_ALIAS] = drConfig[COLUMN.PARAM_ALIAS].ToString();
                drChartList[COLUMN.MAIN_YN]     = drConfig[COLUMN.MAIN_YN].ToString();

                if (strParamAlias == "")
                {
                    strParamAlias = drConfig[COLUMN.PARAM_ALIAS].ToString();
                }

                DataRow[] drContexts = dtContext.Select(string.Format("{0} = '{1}'", COLUMN.MODEL_CONFIG_RAWID, drConfig[COLUMN.RAWID]));

                foreach (DataRow drContext in drContexts)
                {
                    //2009-11-27 bskwon 추가 : Sub Model 상속 구조가 아닌경우 예외처리
                    if (!dtSPCModelChartList.Columns.Contains(drContext["CONTEXT_KEY_NAME"].ToString()))
                    {
                        dtSPCModelChartList.Columns.Add(drContext["CONTEXT_KEY_NAME"].ToString());
                    }

                    drChartList[drContext["CONTEXT_KEY_NAME"].ToString()] = drContext[COLUMN.CONTEXT_VALUE].ToString();
                }

                //MODEL 정보
                drChartList[COLUMN.CREATE_BY]   = drConfig[COLUMN.CREATE_BY].ToString();
                drChartList[COLUMN.CREATE_DTTS] = drConfig[COLUMN.CREATE_DTTS] == DBNull.Value ? null : DateTime.Parse(drConfig[COLUMN.CREATE_DTTS].ToString()).ToString(Definition.DATETIME_FORMAT_MS).ToString();
                dtSPCModelChartList.Rows.Add(drChartList);
            }

            dtSPCModelChartList.AcceptChanges();

            this.bsprData.DataSet = dtSPCModelChartList;

            for (int cIdx = 0; cIdx < this.bsprData.ActiveSheet.Columns.Count; cIdx++)
            {
                this.bsprData.ActiveSheet.Columns[cIdx].Width = this.bsprData.ActiveSheet.Columns[cIdx].GetPreferredWidth();
            }

            this.bsprProductData.DataSource = this._dsSPCProductData;

            for (int i = 0; i < this._dsSPCProductData.Tables[0].Rows.Count; i++)
            {
                this.srtLstProductID.Add(this._dsSPCProductData.Tables[0].Rows[i][0].ToString(), this._dsSPCProductData.Tables[0].Rows[i][1].ToString());
            }

            this.bsprData.Locked        = true;
            this.bsprProductData.Locked = true;
        }