コード例 #1
0
        /// <summary>
        /// 添加標簽顯示語言數據
        /// </summary>
        /// <param name="requestValue"></param>
        /// <param name="Data"></param>
        /// <param name="StationReturn"></param>
        public void AddPageLanguage(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec           sfcdb     = null;
            string            InsertSql = "";
            T_C_LANGUAGE_PAGE language;
            string            PageName  = Data["PageName"].ToString().Trim();
            string            LabelName = Data["LabelName"].ToString().Trim();
            string            Chinese   = Data["Chinese"].ToString().Trim();
            string            ChineseWT = Data["ChineseWT"].ToString().Trim();
            string            English   = Data["English"].ToString().Trim();

            try
            {
                sfcdb    = this.DBPools["SFCDB"].Borrow();
                language = new T_C_LANGUAGE_PAGE(sfcdb, DBTYPE);
                if (language.CheckDataExist(PageName, LabelName, sfcdb))
                {
                    Row_C_LANGUAGE_PAGE row = (Row_C_LANGUAGE_PAGE)language.NewRow();
                    row.ID          = language.GetNewID(BU, sfcdb);
                    row.PAGE_NAME   = PageName;
                    row.LABEL_NAME  = LabelName;
                    row.CHINESE     = Chinese;
                    row.CHINESE_TW  = ChineseWT;
                    row.ENGLISH     = English;
                    row.EDIT_EMP    = LoginUser.EMP_NO;
                    row.SYSTEM_NAME = SystemName;
                    row.EDIT_TIME   = GetDBDateTime();
                    InsertSql       = row.GetInsertString(DBTYPE);
                    sfcdb.ExecSQL(InsertSql);
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    this.DBPools["SFCDB"].Return(sfcdb);
                    //    StationReturn.MessagePara.Add("46545645674");
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                }
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
コード例 #2
0
        /// <summary>
        /// Excel導入多語言數據
        /// </summary>
        /// <param name="requestValue"></param>
        /// <param name="Data"></param>
        /// <param name="StationReturn"></param>
        public void ExcelImport(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec               sfcdb = null;
            T_C_LANGUAGE_PAGE     language;
            string                InsertSql    = "";
            string                repeat       = "";
            string                Fail         = "";
            string                IsNull       = "";
            string                Messaeg      = "";
            string                LabelName    = "";
            string                ChineseTW    = "";
            string                Chinese      = "";
            string                English      = "";
            string                PageName     = "";
            List <C_LanguagePage> LanguagePage = JsonConvert.DeserializeObject <List <C_LanguagePage> >(Data["jsond"].ToString());

            sfcdb = this.DBPools["SFCDB"].Borrow();
            for (int i = 0; i < LanguagePage.Count; i++)
            {
                try {
                    PageName  = LanguagePage[i].PageName.ToString().Trim();
                    LabelName = LanguagePage[i].labelName.ToString().Trim();
                    ChineseTW = LanguagePage[i].ChineseTW.ToString().Trim();
                    Chinese   = LanguagePage[i].Chinese.ToString().Trim();
                    English   = LanguagePage[i].English.ToString().Trim();
                }
                catch (Exception e) {
                    IsNull = IsNull + LabelName + ",";
                }

                try
                {
                    language = new T_C_LANGUAGE_PAGE(sfcdb, DBTYPE);
                    if (language.CheckDataExist(PageName, LabelName, sfcdb))
                    {
                        Row_C_LANGUAGE_PAGE row = (Row_C_LANGUAGE_PAGE)language.NewRow();
                        row.ID          = language.GetNewID(BU, sfcdb);
                        row.PAGE_NAME   = PageName;
                        row.LABEL_NAME  = LabelName;
                        row.CHINESE     = Chinese;
                        row.CHINESE_TW  = ChineseTW;
                        row.ENGLISH     = English;
                        row.EDIT_EMP    = LoginUser.EMP_NO;
                        row.SYSTEM_NAME = SystemName;
                        row.EDIT_TIME   = GetDBDateTime();
                        InsertSql       = row.GetInsertString(DBTYPE);
                        sfcdb.ExecSQL(InsertSql);
                        //StationReturn.Status = StationReturnStatusValue.Pass;
                        //StationReturn.MessageCode = "MES00000002";


                        //    StationReturn.MessagePara.Add("46545645674");
                    }
                    else
                    {
                        repeat = repeat + LabelName + ",";
                        //StationReturn.Status = StationReturnStatusValue.Fail;
                        //StationReturn.MessageCode = "MES00000005";
                    }
                }
                catch (Exception e)
                {
                    Fail = Fail + LabelName + ",";
                    //this.DBPools["SFCDB"].Return(sfcdb);
                    //throw e;
                }
            }
            if (repeat != "")
            {
                Messaeg = Messaeg + "標籤名" + repeat + "已存在  ";
            }
            if (Fail != "")
            {
                Messaeg = Messaeg + "標籤名" + Fail + "導入失敗  ";
            }
            if (IsNull != "")
            {
                Messaeg = Messaeg + "標籤名" + Fail + "數據為空  ";
            }
            if (Messaeg == "")
            {
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000002";
            }
            else
            {
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = Messaeg;
            }
            this.DBPools["SFCDB"].Return(sfcdb);
        }