コード例 #1
0
        public void TestScriptSpecificClass()
        {
            string expectedResult      = "Returned value from TestScript!";
            IScriptInstanceTest script = (IScriptInstanceTest)ScriptUtil.GetScriptObject(@"testscript.cs", "TestScript");

            Assert.AreEqual <string>(expectedResult, script.GetTestValue());
        }
コード例 #2
0
 private void UpdateBackKeyAndroid()
 {
     if (GUIManager.IsEnableBackKeyAndroid() && Input.GetKeyDown(KeyCode.Escape))
     {
         ScriptUtil.ShowCommonDialog(new Action <int>(this.AppQuit), "BackKeyConfirmTitle", "BackKeyConfirmExit", "SEInternal/Common/se_106");
     }
 }
コード例 #3
0
ファイル: UserRole.aspx.cs プロジェクト: plz821/entCMS
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            List <cmsUserRole> ls = new List <cmsUserRole>();

            foreach (ListItem item in cblRoles.Items)
            {
                if (item.Selected)
                {
                    cmsUserRole ur = new cmsUserRole();
                    ur.UserId = Convert.ToInt64(id);
                    ur.RoleId = Convert.ToInt64(item.Value);

                    ls.Add(ur);
                }
            }

            int r = 0;

            try
            {
                r = urs.Add(Convert.ToInt64(id), ls);

                ScriptUtil.AlertAndCloseDialog("角色分配成功!");
            }
            catch (Exception ex)
            {
                ScriptUtil.Alert("服务器发生未知错误!");

                Logger.Error(ex.Message);
            }
        }
コード例 #4
0
        public void TestScriptMismatchedClassName()
        {
            string expectedResult = "some value";

            IScriptInstanceTest script = null;

            try
            {
                script = (IScriptInstanceTest)ScriptUtil.GetScriptObject(@"testClassMismatch.cs");
            }
            catch (NullReferenceException ex)
            {
                Assert.IsNull(script);
            }

            try
            {
                script = (IScriptInstanceTest)ScriptUtil.GetScriptObject(@"testClassMismatch.cs", "MismatchedClassName");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            Assert.IsNotNull(script);
            Assert.AreEqual <string>(expectedResult, script.GetTestValue());
        }
コード例 #5
0
ファイル: BasicSet.aspx.cs プロジェクト: plz821/entCMS
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            string tab = hidTab.Value;

            Dictionary <string, string> dic = new Dictionary <string, string>();

            if (tab == "0")
            {
                dic.Add("WebName", txtWebName.Text);
                dic.Add("WebLogo", hidLogo.Value);
                dic.Add("WebUrl", txtWebUrl.Text);
                dic.Add("Keywords", txtKeywords.Text);
                dic.Add("Description", txtDescription.Text);
                dic.Add("FootInfo", txtFootInfo.Text);
                dic.Add("ThirdCode", txtThirdCode.Text);
                dic.Add("UrlRewrite", chkUrlRewrite.Checked ? "true" : "false");
            }
            else if (tab == "1")
            {
                dic.Add("Sender", txtSender.Text);
                dic.Add("Email", txtEmail.Text);
                dic.Add("Password", txtPassword.Text);
                dic.Add("SMTP", txtSMTP.Text);
            }

            ConfigHelper.SetVal(configFile, dic);
            ScriptUtil.Alert("设置保存成功");
        }
コード例 #6
0
        /// <summary>
        /// 还原reader的opcode dict
        /// </summary>
        public void OpcodeDictRestore()
        {
            var opcodes = (Dictionary <byte, ScriptOpcode>)ScriptUtil.Clone(bytesToOpcodeDict);

            reader.SetOpcodeDict(opcodes);
            ReReadCodeLine();
        }
コード例 #7
0
        /// <summary>
        /// 01.创建或载入OPCODE,初始化bytesToOpcodeDict
        /// </summary>
        /// <param name="opcode"></param>
        /// <returns></returns>
        private int LoadOpcode(string opcode = "")
        {
            int  version = 0;
            bool notNull = true;

            if (opcode == "")
            {
                notNull = false;
            }
            else if (File.Exists(opcode))
            {
                string[] dic;
                dic = File.ReadAllLines(opcode);
                bytesToOpcodeDict.Clear();
                if (dic.Length > 0)
                {
                    if (dic[0].Trim() == ";Ver3")
                    {
                        version = 3;
                    }
                    else if (dic[0].Trim() == ";Ver2")
                    {
                        version = 2;
                    }
                }
                int i = 0;
                foreach (string line in dic)
                {
                    if (line.TrimStart()[0] == ';')
                    {
                        continue;
                    }
                    bytesToOpcodeDict.Add((byte)i, new ScriptOpcode((byte)i, line.Replace("\r", "")));
                    i++;
                }
                if (bytesToOpcodeDict.Count == 0) // 文件为空
                {
                    notNull = false;
                }
                else
                {
                    Debug.WriteLine("已加载opcode文件:{0}", Path.GetFileName(opcode));
                }
            }
            else // 文件不存在
            {
                notNull = false;
            }

            if (!notNull)
            {
                for (int i = 0; i < 128; i++)
                {
                    bytesToOpcodeDict.Add((byte)i, new ScriptOpcode((byte)i, "OP_" + ScriptUtil.Byte2Hex((byte)i)));
                }
                Debug.WriteLine("无opcode文件或无opcode,创建默认opcode");
            }
            return(version);
        }
コード例 #8
0
ファイル: ServicerSet.aspx.cs プロジェクト: plz821/entCMS
 protected void Page_PreRender(object sender, EventArgs e)
 {
     ScriptUtil.RegisterStartupScript("onlineposition(" + type + ",'')", true);
     if (lang == null)
     {
         (Master as MasterPage).SetPageInfo(GetPageInfo("当前语言未指定", "请在左边栏里选择当前语言。如果还未设置站点语言,请点击 <a href='LanguageList.aspx'>[语言设置]</a>"));
     }
 }
コード例 #9
0
        public void TestScriptAnyClass()
        {
            string expectedResult      = "Returned value from TestScript!";
            IScriptInstanceTest script = (IScriptInstanceTest)ScriptUtil.GetScriptObject(@"testscript.cs");

            Assert.IsNotNull(script, "The returned script object cannot be null!");
            Assert.AreEqual <string>(expectedResult, script.GetTestValue());
        }
コード例 #10
0
 private void Caching()
 {
     AnimCntrl          = GetComponent <PlayerAnimCntrl>();
     OriginalHPImage    = new Sprite[3];
     OriginalHPImage[0] = ScriptUtil.ValidateSpriteResource("Sprite/HP/HP_Empty");
     OriginalHPImage[1] = ScriptUtil.ValidateSpriteResource("Sprite/HP/HP_Half");
     OriginalHPImage[2] = ScriptUtil.ValidateSpriteResource("Sprite/HP/HP_Full");
 }
コード例 #11
0
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtOrder.Text.Trim()))
            {
                txtOrder.Text = "0";
            }

            if (action.Equals("add"))
            {
                lang = new cmsLanguage();
            }
            else
            {
                lang = lgs.Get(id);
                if (lang != null)
                {
                    lang.Attach();
                }
                else
                {
                    lang = new cmsLanguage();
                }
            }
            lang.Name      = txtName.Text;
            lang.ShortName = txtShortName.Text;
            lang.Code      = txtCode.Text;
            lang.HomeUrl   = string.IsNullOrEmpty(txtUrl.Text) ? "/" : txtUrl.Text;
            lang.OrderNo   = Convert.ToInt32(txtOrder.Text);
            lang.IsDefault = chkDefault.Checked ? 1 : 0;
            lang.IsEnabled = chkEnabled.Checked ? 1 : 0;
            lang.Remark    = txtRemark.Text;
            try
            {
                long r = lgs.Save(lang);
                if (action.Equals("edit"))
                {
                    r = lang.Id;
                }
                hidID.Value = r.ToString();
                // 创建模板目录下的语言配置文件
                CreateLangConfigFile(lang);
                //
                if (action.Equals("add"))
                {
                    ScriptUtil.ConfirmAndRedirect(@"语言添加成功!\n“确定”继续添加,“取消”则跳转到列表页。", "LanguageAdd.aspx?node=" + NodeCode, "LanguageList.aspx?node=" + NodeCode);
                }
                else
                {
                    ScriptUtil.ConfirmAndRedirect(@"语言修改成功!\n“确定”留在本页,“取消”则跳转到列表页。", "LanguageAdd.aspx?node=" + NodeCode + "&id=" + id, "LanguageList.aspx?node=" + NodeCode);
                }
            }
            catch (Exception ex)
            {
                ScriptUtil.Alert(ex.Message);

                Logger.Error(ex.Message);
            }
        }
コード例 #12
0
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            long lngId = long.Parse(ddlLanguage.SelectedValue);

            if (lngId == 0)
            {
                ScriptUtil.Alert("请先选择所属语言");
                return;
            }
            if (action.Equals("add"))
            {
                if (cs.Exists(lngId))
                {
                    ScriptUtil.Alert("该语言下已有公司信息不能再次添加");
                    return;
                }
                com = new cmsCompany();
            }
            else
            {
                com = cs.GetModel(id);
                com.Attach();
            }

            com.LangId     = lngId;
            com.ComName    = txtName.Text;
            com.ComAddr    = txtAddr.Text;
            com.ComZipcode = txtZipCode.Text;
            com.ComTel     = txtTel.Text;
            com.ComFax     = txtFax.Text;
            com.ComEmail   = txtEmail.Text;
            com.ComUrl     = txtUrl.Text;
            com.Summary    = txtSummary.Text;
            try
            {
                long r = cs.SaveModel(com);
                if (action.Equals("edit"))
                {
                    r = com.Id;
                }
                hidID.Value = r.ToString();
                if (action.Equals("add"))
                {
                    ScriptUtil.ConfirmAndRedirect(@"公司信息添加成功!\n“确定”继续添加,“取消”则跳转到列表页。", "CompanyAdd.aspx?node=" + NodeCode, "CompanyList.aspx?node=" + NodeCode);
                }
                else
                {
                    ScriptUtil.ConfirmAndRedirect(@"公司信息修改成功!\n“确定”留在本页,“取消”则跳转到列表页。", "CompanyAdd.aspx?node=" + NodeCode + "&id=" + id, "CompanyList.aspx?node=" + NodeCode);
                }
            }
            catch (Exception ex)
            {
                ScriptUtil.Alert(ex.Message);

                Logger.Error(ex.Message);
            }
        }
コード例 #13
0
        public void TestCreateScriptResult()
        {
            ScriptResult.ResultType resulttype = ScriptResult.ResultType.Success;
            string message = "My result message.";

            IScriptResult result = ScriptUtil.CreateResult(resulttype, message);

            Assert.AreEqual <ScriptResult.ResultType>(resulttype, result.Result);
            Assert.AreEqual <string>(message, result.Message);
        }
コード例 #14
0
        public async Task <IRestResponse <VersionAPIResponse> > GetVersionAPIResponse()
        {
            var endpoint = $"translate/version/{ScriptUtil.GetBuild()}?_ts={DateTimeOffset.UtcNow.ToUnixTimeSeconds()}";
            var request  = new RestRequest(endpoint)
            {
                Method = Method.POST
            };

            return(await ExecuteAsync <VersionAPIResponse>(request));
        }
コード例 #15
0
 public void SetDisplayNumber(double number)
 {
     if (hasDigitDelimitter)
     {
         text.text = ScriptUtil.AbbreviateLongNumber(number);
     }
     else
     {
         text.text = number.ToString();
     }
 }
コード例 #16
0
        public void TestCreateScriptRequestNoClassName()
        {
            string instr  = "This is an instruction with a pre-defined statement.";
            string script = "This is a script file name.";

            IScriptRequest request = ScriptUtil.CreateRequest(instr, script);

            Assert.AreEqual <string>(instr, request.Instruction);
            Assert.AreEqual <string>(script, request.ScriptName);
            Assert.IsNull(request.ScriptClassName);
        }
コード例 #17
0
 public AboutPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     ShowCorrectAuthenticationButton();
     ShowCorrectAutoUpdateButton();
     this.Version.Text       = ScriptUtil.GetVersionName();
     RetryAndroid11.Clicked += RetryAndroid11OnClicked;
     ChangeLanguage.Clicked += ChangeLanguageOnClicked;
     ResetApp.Clicked       += ResetAppOnClicked;
 }
コード例 #18
0
 public void TestScriptBadClassName()
 {
     try
     {
         IScriptInstanceTest script = (IScriptInstanceTest)ScriptUtil.GetScriptObject(@"testscript.cs", "Oops");
     }
     catch (NullReferenceException ex)
     {
         return;
     }
     Assert.Fail("The method should have returned by now.");
 }
コード例 #19
0
        public void TestCreateScriptRequestClassName()
        {
            string instr     = "My instruction.";
            string script    = "myscript.cs";
            string classname = "MyScript";

            IScriptRequest request = ScriptUtil.CreateRequest(instr, script, classname);

            Assert.AreEqual <string>(instr, request.Instruction);
            Assert.AreEqual <string>(script, request.ScriptName);
            Assert.AreEqual <string>(classname, request.ScriptClassName);
        }
コード例 #20
0
        private string ProcessUsingScriptFile(string clipboardText, string scriptFileDirectoryFullPath, ComboBox comboBoxScriptFileList,
                                              bool processedResultAutoCopy, bool processedResultAppendToEnd, TextBox textBoxProcessedResult)
        {
            string scriptFileName = comboBoxScriptFileList.SelectedValue as string;

            if (scriptFileName == null)
            {
                SetMultilineTextBoxText(textBoxProcessedResult, string.Empty);
                return(null);
            }

            string scriptFileFullPath = Path.Combine(scriptFileDirectoryFullPath, scriptFileName);

            if (!File.Exists(scriptFileFullPath))
            {
                SetMultilineTextBoxText(textBoxProcessedResult, string.Empty);
                return(null);
            }

            string scriptFileExtension = Path.GetExtension(scriptFileFullPath).TrimStart('.').ToLower();
            ScriptInterpreterItem scriptInterpreter = ApplicationService.Config.GetScriptInterpreter(scriptFileExtension);

            string processedResult = ScriptUtil.CallScriptInterpreter(scriptInterpreter, scriptFileFullPath, clipboardText);

            if (processedResultAutoCopy)
            {
                SetClipboardText(processedResult);
            }

            if (processedResultAppendToEnd)
            {
                string originalProcessedResult = GetMultilineTextBoxText(textBoxProcessedResult);

                if (originalProcessedResult == string.Empty)
                {
                    SetMultilineTextBoxText(textBoxProcessedResult, processedResult);
                }
                else
                {
                    SetMultilineTextBoxText(textBoxProcessedResult, originalProcessedResult
                                            + (_textareaLineEndingNormalizeToCrLf ? "\r\n" : Environment.NewLine)
                                            + processedResult);
                }
            }
            else
            {
                SetMultilineTextBoxText(textBoxProcessedResult, processedResult);
            }

            textBoxProcessedResult.Select(textBoxProcessedResult.Text.Length, 0);

            return(processedResult);
        }
コード例 #21
0
        /// <summary>
        /// 02.载入脚本
        /// </summary>
        /// <param name="id">编号</param>
        public void LoadScript(int id)
        {
            if (scriptLoaded)
            {
                reader.Close();
            }
            scriptLoaded = true;
            index        = id;
            var opcodes = (Dictionary <byte, ScriptOpcode>)ScriptUtil.Clone(bytesToOpcodeDict);

            reader = new ScriptReader(ScriptFilename(index), opcodes, scriptVersion);
            reader.ReadScript(); // 读入整个脚本
            CurrentCodeID = 0;
        }
コード例 #22
0
        /// <summary>
        /// Restful API
        /// </summary>
        public RestfulAPI()
        {
#if DEBUG
            _client = new RestClient($"{EndpointURL.EndPoint}/api/v1/");
            ServicePointManager.ServerCertificateValidationCallback +=
                (sender, certificate, chain, sslPolicyErrors) => true;

            //_client.Proxy = new WebProxy("");
#else
            _client = new RestClient($"{EndpointURL.EndPoint}/api/v1/");
#endif
            var userAgent = Java.Lang.JavaSystem.GetProperty("http.agent");
            _client.UserAgent = $"TranslateFGO {ScriptUtil.GetBuild()} {userAgent}";
            _assets           = Android.App.Application.Context.Assets;
        }
コード例 #23
0
ファイル: SlideshowAdd.aspx.cs プロジェクト: plz821/entCMS
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtOrder.Text.Trim()))
            {
                txtOrder.Text = "0";
            }
            if (action.Equals("add"))
            {
                mdl         = new cmsSlideshow();
                mdl.AddTime = DateTime.Now;
            }
            else
            {
                mdl = ss.GetModel(id);
                if (mdl != null)
                {
                    mdl.Attach();
                }
            }
            mdl.LangId    = CurrentLanguageId;
            mdl.Title     = txtTitle.Text;
            mdl.Summary   = txtSummary.Text;
            mdl.ImgSrc    = txtImgSrc.Text;
            mdl.ImgThumb  = txtImgThumb.Text;
            mdl.Url       = txtUrl.Text;
            mdl.Target    = ddlTarget.SelectedValue;
            mdl.OrderNo   = Convert.ToInt32(txtOrder.Text.Trim());
            mdl.IsEnabled = chkEnabled.Checked ? 1 : 0;
            try
            {
                int r = ss.SaveModel(mdl);

                if (action.Equals("add"))
                {
                    ScriptUtil.ConfirmAndRedirect(@"幻灯片添加成功!\n“确定”继续添加,“取消”则跳转到列表页。", "SlideshowAdd.aspx?node=" + NodeCode, "SlideshowList.aspx?node=" + NodeCode);
                }
                else
                {
                    ScriptUtil.ConfirmAndRedirect(@"幻灯片修改成功!\n“确定”留在本页,“取消”则跳转到列表页。", "SlideshowAdd.aspx?node=" + NodeCode + "&id=" + id + "&action=" + action, "SlideshowList.aspx?node=" + NodeCode);
                }
            }
            catch (Exception ex)
            {
                ScriptUtil.Alert(ex.Message);

                Logger.Error(ex.Message);
            }
        }
コード例 #24
0
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtOrder.Text.Trim()))
            {
                txtOrder.Text = "0";
            }


            if (action.Equals("add"))
            {
                link = new cmsLink();
            }
            else
            {
                link = ls.GetModel(id);
                if (link != null)
                {
                    link.Attach();
                }
            }
            link.GroupId   = Convert.ToInt64(ddlType.SelectedValue);
            link.Name      = txtName.Text.Trim();
            link.Url       = txtUrl.Text.Trim();
            link.Logo      = txtLogo.Text;
            link.OrderNo   = Convert.ToInt32(txtOrder.Text.Trim());
            link.IsEnabled = chkEnabled.Checked ? 1 : 0;
            link.Remark    = txtMemo.Text;
            link.LangId    = CurrentLanguageId;
            try
            {
                int r = ls.SaveModel(link);

                if (action.Equals("add"))
                {
                    ScriptUtil.ConfirmAndRedirect(@"链接添加成功!\n“确定”继续添加,“取消”则跳转到列表页。", "LinkAdd.aspx?node=" + NodeCode, "LinkList.aspx?node=" + NodeCode);
                }
                else
                {
                    ScriptUtil.ConfirmAndRedirect(@"链接修改成功!\n“确定”留在本页,“取消”则跳转到列表页。", "LinkAdd.aspx?node=?" + NodeCode + "&id=" + id + "&action=edit", "LinkList.aspx?node=" + NodeCode);
                }
            }
            catch (Exception ex)
            {
                ScriptUtil.Alert(ex.Message);

                Logger.Error(ex.Message);
            }
        }
コード例 #25
0
ファイル: ScriptManager.cs プロジェクト: CBorange/MimePark
    // 현재 스테이지의 대화 스크립트 로드
    private void InitializeDictionary()
    {
        // 다이얼로그에서 사용할 스프라이트 리소스 로드
        dialogSpriteResources = new Dictionary <string, Sprite>();
        dialogSpriteResources.Add("PlayerImage", ScriptUtil.ValidateSpriteResource("Sprite/DialogUI/PlayerImage"));
        dialogSpriteResources.Add("None", ScriptUtil.ValidateSpriteResource("Sprite/DialogUI/None"));
        dialogSpriteResources.Add("DialogBG_L", ScriptUtil.ValidateSpriteResource("Sprite/DialogUI/DialogBG_L"));
        dialogSpriteResources.Add("DialogBG_R", ScriptUtil.ValidateSpriteResource("Sprite/DialogUI/DialogBG_R"));

        // 다이얼로그 종료 콜백 함수 캐싱
        dialogEndCallbackDic = new Dictionary <string, DialogEndCallback>();
        dialogEndCallbackDic.Add("PrintGameGuide", PrintGameGuide);
        dialogEndCallbackDic.Add("PlayEndingCredit", PlayEndingCredit);
        dialogEndCallbackDic.Add("ActiveMonster", ActiveMonster);
        dialogEndCallbackDic.Add("None", DoNothing);
    }
コード例 #26
0
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            string tab = hidTab.Value;

            Dictionary <string, string> dic = new Dictionary <string, string>();

            if (tab == "0")
            {
                dic.Add("AutoDelImg", chkAutoDelImg.Checked ? "1" : "0");
                dic.Add("AutoRename", chkAutoRename.Checked ? "1" : "0");
                dic.Add("AutoCreateThumbnail", chkAutoCreateThumbnail.Checked ? "1" : "0");
                dic.Add("CreateThumbnailMode", rblCreateThumbnailMode.SelectedValue);
                dic.Add("ProductThumbnailWidth", txtProductThumbnailWidth.Text);
                dic.Add("ProductThumbnailHeight", txtProductThumbnailHeight.Text);
                dic.Add("NewsThumbnailWidth", txtNewsThumbnailWidth.Text);
                dic.Add("NewsThumbnailHeight", txtNewsThumbnailHeight.Text);
                dic.Add("ImageThumbnailWidth", txtImageThumbnailWidth.Text);
                dic.Add("ImageThumbnailHeight", txtImageThumbnailHeight.Text);
            }
            else if (tab == "1")
            {
                string v = "";
                foreach (ListItem item in cblAddWaterMark.Items)
                {
                    if (item.Selected)
                    {
                        v += "|" + item.Value + "|";
                    }
                }
                dic.Add("AddWaterMark", v);
                dic.Add("WaterMarkType", rblWaterMarkType.SelectedValue);
                dic.Add("WaterMarkImg", hidImages1.Value);
                dic.Add("ThumbnailWaterMarkImg", hidImages2.Value);
                dic.Add("WaterMarkTextFontSize", txtWaterMarkTextFontSize.Text);
                dic.Add("ThumbnailWaterMarkTextFontSize", txtThumbnailWaterMarkTextFontSize.Text);
                dic.Add("WaterMarkTextFont", txtWaterMarkTextFont.Text);
                dic.Add("WaterMarkText", txtWaterMarkText.Text);
                dic.Add("WaterMarkTextColor", txtWaterMarkTextColor.Text);
                dic.Add("WaterMarkAngle", txtWaterMarkAngle.Text);
                dic.Add("WaterMarkAlpha", txtWaterMarkAlpha.Text);
                dic.Add("WaterMarkPosition", rblWaterMarkPosition.SelectedValue);
            }

            ConfigHelper.SetVal(configFile, dic);
            ScriptUtil.Alert("设置保存成功");
        }
コード例 #27
0
        public void TestScriptPassObject()
        {
            string expectedResult1     = "world";
            string expectedResult2     = "hello";
            int    expectedSize        = 2;
            IScriptInstanceTest script = (IScriptInstanceTest)ScriptUtil.GetScriptObject(@"testscript.cs");
            List <string>       list   = new List <string>();

            list.Add("world");
            script.StoreTestObject(list);
            IList <string> newlist = script.RetrieveTestObject();

            Assert.IsNotNull(newlist);
            Assert.AreEqual <int>(expectedSize, newlist.Count);
            Assert.AreEqual <string>(expectedResult1, newlist[0]);
            Assert.AreEqual <string>(expectedResult2, newlist[1]);
        }
コード例 #28
0
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            if (action.Equals("add"))
            {
                serv = new cmsServicer();
            }
            else
            {
                serv = ss.GetModel(id);
                serv.Attach();
            }
            serv.LangId    = CurrentLanguageId;
            serv.Name      = txtName.Text;
            serv.QQ        = txtQQ.Text;
            serv.MSN       = txtMSN.Text;
            serv.TaobaoWW  = txtTaobao.Text;
            serv.AliWW     = txtAli.Text;
            serv.SKYPE     = txtSkype.Text;
            serv.OrderNo   = Convert.ToInt32(txtOrder.Text);
            serv.IsEnabled = chkEnabled.Checked ? 1 : 0;
            try
            {
                long r = ss.SaveModel(serv);
                if (action.Equals("edit"))
                {
                    r = serv.Id;
                }
                hidID.Value = r.ToString();
                if (action.Equals("add"))
                {
                    ScriptUtil.ConfirmAndRedirect(@"客服添加成功!\n“确定”继续添加,“取消”则跳转到列表页。", "ServicerAdd.aspx?node=" + NodeCode, "ServicerList.aspx?node=" + NodeCode);
                }
                else
                {
                    ScriptUtil.ConfirmAndRedirect(@"客服修改成功!\n“确定”留在本页,“取消”则跳转到列表页。", "ServicerAdd.aspx?node=" + NodeCode + "&id=" + id, "ServicerList.aspx?node=" + NodeCode);
                }
            }
            catch (Exception ex)
            {
                ScriptUtil.Alert(ex.Message);

                Logger.Error(ex.Message);
            }
        }
コード例 #29
0
ファイル: ServicerSet.aspx.cs プロジェクト: plz821/entCMS
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            type = rblType.SelectedValue;
            int t = int.Parse(type);

            if (t == 1 || t == 2)
            {
                x = txtX1.Text;
                y = txtY1.Text;
            }
            else if (t == 3 || t == 4)
            {
                x = txtX2.Text;
                y = txtY2.Text;
            }
            style  = ddlStyle.SelectedValue;
            color  = ddlStyleColor.SelectedValue;
            qq     = Request["met_qq_type"];
            msn    = Request["met_msn_type"];
            tb     = Request["met_taobao_type"];
            ali    = Request["met_alibaba_type"];
            skype  = Request["met_skype_type"];
            onname = chkOnName.Checked ? "0" : "1";
            info   = txtOtherInfo.Text;

            dic.Add("OnlineType", rblType.SelectedValue);
            dic.Add("OnlineX", x);
            dic.Add("OnlineY", y);
            dic.Add("OnlineStyle", style);
            dic.Add("OnlineStyleColor", color);
            dic.Add("OnlineIconQQ", qq);
            dic.Add("OnlineIconMSN", msn);
            dic.Add("OnlineIconTaobao", tb);
            dic.Add("OnlineIconAli", ali);
            dic.Add("OnlineIconSkype", skype);
            dic.Add("OnlineOnName", onname);
            dic.Add("OnlineOtherInfo", info);

            ConfigHelper.SetVal(configFile, dic);
            ScriptUtil.Alert("设置保存成功");
        }
コード例 #30
0
        public void TestCreateTransaction()
        {
            bool           rollback  = true;
            string         instr     = "My instruction.";
            string         script    = "script.cs";
            string         className = "Script";
            string         instr2    = "My other instruction.";
            IScriptRequest request;

            IScriptTransaction trans = ScriptUtil.CreateTransaction(rollback);

            Assert.AreEqual <bool>(rollback, trans.RollbackOnFail);
            Assert.IsNotNull(trans.Requests);
            Assert.AreEqual <int>(0, trans.Requests.Count);

            trans.AddRequest(ScriptUtil.CreateRequest(instr, script, className));

            Assert.AreEqual <int>(1, trans.Requests.Count);

            request = trans.GetRequest(false);

            Assert.AreEqual <string>(instr, request.Instruction);
            Assert.AreEqual <int>(1, trans.Requests.Count);

            trans.AddRequest(ScriptUtil.CreateRequest(instr2, script, className));
            request = trans.GetRequest(true);

            Assert.AreEqual <string>(instr, request.Instruction);
            Assert.AreEqual <int>(1, trans.Requests.Count);

            request = trans.GetRequest();

            Assert.AreEqual <string>(instr2, request.Instruction);
            Assert.AreEqual <int>(0, trans.Requests.Count);

            request = trans.GetRequest();

            Assert.IsNull(request);

            request = trans.GetRequest(true);

            Assert.IsNull(request);
        }