コード例 #1
0
        public JsonResult Request(string name, string email, string text)
        {
            try
            {
                var new_cs = new Cs
                {
                    created_at = DateTime.Now,
                    email      = email,
                    name       = name,
                    text       = text,
                    updated_at = DateTime.Now
                };
                db.Cs.Add(new_cs);
                db.SaveChanges();

                var result = new
                {
                    state = "ok"
                };

                return(Json(result, "application/json", Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }
            catch (HttpException e)
            {
                Response.StatusCode = e.GetHttpCode();
                return(Json(e.Message, "application/json", Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
ファイル: Sel.aspx.cs プロジェクト: sx81128/AppInOneBPM
    /// <summary>
    /// 获取list页的数据源
    /// 支持主模块的链接
    /// 支持枚举量
    /// 支持时间格式
    /// </summary>
    /// <param name="f1"></param>
    /// <returns></returns>
    public string GetHtmlList(DataBaseField f1, ITableImplement this1)
    {
        if (!f1.Desc.af_Enable)
        {
            return("");                       //是否可用
        }
        if (!f1.Desc.af_Visable)
        {
            return("");                        //是否可见
        }
        string        html      = "";
        string        tableName = f1.TableName;
        AttributeItem attr1     = AttributeItem.Factory(f1);
        object        value1    = (this1.GetValue(attr1));
        DataBaseTable dt1       = f1.DataBaseTable; //DataBaseField f1;

        try
        {
            DataBaseField id1   = dt1.IDField;
            DataBaseField name1 = dt1.NameField;

            if (f1 == dt1.IDField)
            {
                //html = "<a href='index.aspx?id=" + this1.GetValue(dt1.FieldID.FieldName) + "'>" + html + "</a>";
            }
            else if (f1 == dt1.NameField)    // != null && dt1.NameField.FieldName == f1.FieldName)//本模块name详细链接
            {
                string showUrl = "../" + dt1.TableName + "/show.aspx";
                if (!Exist(showUrl))
                {
                    showUrl = "show.aspx";
                }
                html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + tableName
                       + "' target='_blank'>" + value1 + "</a>";
            }
            else if (isSelect(f1))    //枚举量
            {
                html = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, value1);
            }
            else if (isChaZhao(f1))    //父表
            {
                DataBaseField f2    = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField;
                AttributeItem attr2 = AttributeItem.Factory(f2);
                html = Convert.ToString(this1.GetValue(attr2));
            }
            else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage)
            {
                html = "<img src ='" + value1 + "' style='height:40px' />";
            }
        }
        catch (Exception ex)
        {
            Cs.Error(ex.ToString());
        }
        if (html == "")
        {
            html = Convert.ToString(value1);
        }
        return(html);
    }
コード例 #3
0
        public IEnumerable <T> ReadRawData <T>(RowReader <T> reader, string fileName) where T : class, new()
        {
            bool firstRow = true;

            try
            {
                while (Cs.ReadRow(Row))
                {
                    if ((Row.Count == 1) && ((Row[0].Value == null) || (string.IsNullOrEmpty(Row[0].Value.Trim()))))
                    {
                        continue;
                    }

                    bool readingResult = reader.ReadingOneRawRow(Row, firstRow);

                    if (readingResult)
                    {
                        yield return(reader.Obj);
                    }
                    firstRow = false;
                }
            }
            finally
            {
                if (!string.IsNullOrEmpty(fileName))
                {
                    _stream.Close();
                }

                Ae.ThrowIfExceptionsStored();
            }
        }
コード例 #4
0
    void _UpdateVertex(List <Node> newPoints)
    {
        Assert.IsTrue(newPoints.Count <= InputNumMax);

        var inputNum = newPoints.Count;

        if (inputNum > 0)
        {
            _inputBuffer.SetData(newPoints.ToArray());
            if (_totalInputIdx < 0)
            {
                _startTime = Time.time;
            }
            _totalInputIdx += inputNum;
        }

        if (_totalInputIdx >= 0)
        {
            SetCommonParameterForCs();

            Cs.SetInt("_InputNum", inputNum);
            Cs.SetInt("_TotalInputIdx", _totalInputIdx);
            Cs.SetInt("_BufferSize", nodeNumPerTrail);
            Cs.SetFloat("_StartTime", _startTime);

            var kernel = Cs.FindKernel("CreateWidth");
            Cs.SetBuffer(kernel, "_InputBuffer", _inputBuffer);
            Cs.SetBuffer(kernel, "_NodeBuffer", nodeBuffer);
            Cs.SetBuffer(kernel, "_VertexBuffer", vertexBuffer);

            Cs.Dispatch(kernel, Mathf.CeilToInt((float)nodeBuffer.count / NUM_THREAD_X), 1, 1);
        }
    }
コード例 #5
0
ファイル: BLL1.cs プロジェクト: linechengchen/m.edianzu.com
    //每过十秒钟检查一下,是否需要升级的升级文件
    public static bool isNeedUpdate()
    {
        if (isNeedUpdateing)
        {
            return(false);
        }
        isNeedUpdateing = true;
        double ts1 = DateTime.Now.Subtract(checkUpdateTime).TotalSeconds;

        if (ts1 > 2)
        {
            string p1    = root1.Replace("考试题", "");
            string file1 = Path.Combine(p1, "升级.txt");
            if (File.Exists(file1))
            {
                string f1 = File.ReadAllText(file1);
                checkUpdateTime = DateTime.Now;
                if (f1 == "1")
                {
                    isNeedUpdateing = false;
                    return(true);
                }
            }
            else
            {
                Cs.Warn("升级文件不存在");
            }
        }
        isNeedUpdateing = false;
        return(false);
    }
コード例 #6
0
ファイル: BLL1.cs プロジェクト: linechengchen/m.edianzu.com
 public static string getFile(string scId)
 {
     try
     {
         initDaxue();
         if (Directory.Exists(file2Wei))
         {
             string numDaXue = null;
             if (Num_DaxueDic.TryGetValue(scId, out numDaXue))
             {
                 AFDictionary <string, FileInfo> dic1 = btnReNameFile_Click(file2Wei);
                 if (dic1.ContainsKey(numDaXue))
                 {
                     return(dic1[numDaXue].Name);
                 }
                 else
                 {
                     Cs.Warn(numDaXue + ",找不到文件");
                 }
             }
         }
     }
     catch (Exception ex1)
     {
         Cs.Warn(ex1.ToString());
     }
     return(scId);
 }
コード例 #7
0
ファイル: WebGet.cs プロジェクト: linechengchen/m.edianzu.com
        /// <summary>
        /// 获取网页验证码图片
        /// </summary>
        /// <param name="url"></param>
        /// <param name="cookie"></param>
        /// <returns></returns>
        public static Image GetWebImage(string url, CookieContainer cookie)
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                //request.Referer = referer;
                request.UserAgent = userAgent;
                request.Accept    = "image/webp,*/*;q=0.8";
                if (cookie != null)
                {
                    request.CookieContainer = cookie;
                }

                //request.ContentType = "multipart/form-data; boundary=" + boundary;
                request.ContentType           = MimeMapping.GetContentTypeByUrl(url);// contentType;
                request.KeepAlive             = true;
                request.UseDefaultCredentials = true;
                //  request.Proxy = null;
                Stream stream = request.GetResponse().GetResponseStream();
                Image  image  = Image.FromStream(stream);
                return(image);
            }catch (Exception ex)
            {
                Cs.Error("74==" + url + "==" + ex.ToString());
            }
            return(null);
        }
コード例 #8
0
        public IEnumerable <T> ReadFieldDataRows <T>(RowReader <T> reader, string fileName,
                                                     FieldMapperReading <T> fm, List <int> charLengths) where T : class, new()
        {
            var firstRow = true;

            try
            {
                while (Cs.ReadRow(Row, charLengths))
                {
                    if ((Row.Count == 1) && ((Row[0].Value == null) || (string.IsNullOrEmpty(Row[0].Value.Trim()))))
                    {
                        continue;
                    }

                    var readingResult = reader.ReadingOneFieldRow(fm, Row, firstRow);

                    if (readingResult)
                    {
                        yield return(reader.Obj);
                    }
                    firstRow = false;
                }
            }
            finally
            {
                if (!string.IsNullOrEmpty(fileName))
                {
                    _stream.Close();
                }

                Ae.ThrowIfExceptionsStored();
            }
        }
コード例 #9
0
    /// <summary>
    /// 查找html
    /// </summary>
    /// <returns></returns>
    protected string getFinder()
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            foreach (DataBaseField f1 in valObj.af_GetAvailableDataBaseField())
            {
                //条件对象有赋值
                if (finderObj.IsNotNull())
                {
                    AttributeItem attr1 = new AttributeItem(f1);
                    if (finderObj.GetInitialized(attr1))
                    {
                        f1.Value = Convert.ToString(finderObj.GetValue(attr1));
                    }
                }
                string     attrHtml = Finder;
                BuildByTag b1       = new BuildByTag(BuildType.ForHtmlValue);
                b1.ParseForSwitch标签(ref attrHtml, f1);
                sb.Append("<dl><dt>").Append(f1.Desc.ZhName).Append(":</dt><!--").Append(f1.FieldName)
                .Append("--><dd><span>");
                sb.Append(attrHtml);
                sb.Append("</span></dd></dl>");
            }
        }
        catch (Exception ex)
        {
            Cs.Error("34" + ex.ToString());
        }
        return(sb.ToString());
    }
コード例 #10
0
ファイル: ProjectService.cs プロジェクト: Agil13/ide-2019
        public Cs CreateCs()
        {
            var cS = new Cs();

            using (var openFileDialog = new OpenFileDialog()) {
                var saveFileDialog1 = new SaveFileDialog {
                    Filter = "cs files (*.cs)|*.cs", FilterIndex = 1, RestoreDirectory = true, AddExtension = true
                };
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    Stream fs;
                    if ((fs = saveFileDialog1.OpenFile()) != null)
                    {
                        cS.Path = saveFileDialog1.FileName;
                        cS.Name = Path.GetFileName(saveFileDialog1.FileName);
                        cS.Text = "using System;\n\nclass " + cS.Name.Substring(0, cS.Name.Length - 3) + "{\n\n \n}";
                        MessageBox.Show(Path.GetFileName(saveFileDialog1.FileName));


                        fs.Close();
                    }
                }
                else
                {
                    return(null);
                }
            }

            return(cS);
        }
コード例 #11
0
ファイル: MoveNotFail.cs プロジェクト: gyyfifafans/PBO
        private static bool ContinuousUse(AtkContext atk, Cs ContinuousUse)
        {
            if (ContinuousUse == Cs.ContinuousUse && atk.Controller.ActingPokemons[atk.Controller.ActingPokemons.Count - 1] == atk.Attacker)
            {
                atk.Attacker.OnboardPokemon.RemoveCondition(ContinuousUse);
                return(false);
            }
            var o = atk.Attacker.OnboardPokemon;
            var c = o.GetCondition(Cs.LastMove);

            if (c != null)
            {
                if (ContinuousUse == Cs.ContinuousUse && c.Move.HardToUseContinuously || ContinuousUse == Cs.ContinuousUse2 && c.Move.Move.Id == Ms.DESTINY_BOND)
                {
                    var count = o.GetCondition <int>(ContinuousUse);
                    if (atk.Controller.GetRandomInt(0, 0xffff - 1) < 0xffff >> count)
                    {
                        o.SetCondition(ContinuousUse, count + 1);
                        return(true);
                    }
                    atk.Attacker.OnboardPokemon.RemoveCondition(ContinuousUse);
                    return(false);
                }
            }
            o.SetCondition(ContinuousUse, 1);
            return(true);
        }
コード例 #12
0
        public override Vector3D SampleF(ref ShadeRec sr, ref Vector3D wo, out Vector3D wi, out double pdf)
        {
            double   NDotWo = sr.Normal.DotProduct(wo);
            Vector3D r      = -wo + 2.0 * sr.Normal.ScaleBy(NDotWo);

            Vector3D w = r;
            Vector3D u = new Vector3D(0.00424, 1, 0.00764).CrossProduct(w).Normalize().ToVector3D();

            Vector3D v = u.CrossProduct(w);

            Vector3D sp = SamplerRef.SampleHemisphere();

            wi = sp.X * u + sp.Y * v + sp.Z * w;

            if (sr.Normal.DotProduct(wi) < 0.0)
            {
                wi = -sp.X * u - sp.Y * v + sp.Z * w;
            }

            double phong_lobe = Math.Pow(r * wi, Exp);

            pdf = phong_lobe * (sr.Normal.DotProduct(wi));

            return(Cs.ScaleBy(phong_lobe).ScaleBy(Ks));
        }
コード例 #13
0
ファイル: Manage.aspx.cs プロジェクト: sx81128/AppInOneBPM
    /// <summary>
    /// 查找html
    /// </summary>
    /// <returns></returns>
    protected string getFinder()
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            foreach (DataBaseField f1 in fieldList)
            {
                f1.Value = null;
                bool isNull1 = finderObj.IsNotNull();
                bool isInit1 = false;
                //条件对象有赋值
                if (isNull1)
                {
                    AttributeItem attr1 = new AttributeItem(f1);
                    isInit1 = finderObj.GetInitialized(attr1);
                    if (isInit1)
                    {
                        f1.Value = Convert.ToString(finderObj.GetValue(attr1));
                    }
                }
                if (f1.ZhName == "多选数量")
                {
                    "".ToString();
                }
                string attrHtml = Finder;
                //jinsj
                foreach (string table1 in f1.Desc.OutSource_ChaZhao.Keys)
                {
                    string selModuleUrl = null;
                    if (f1.Desc.Switch_CtrlType == BaseCtrlType.SelectMultiple)
                    {
                        selModuleUrl = "Sels.aspx?moduleName=" + table1 + "&r=" + DateTime.Now.Ticks;
                    }
                    else
                    {
                        selModuleUrl = "Sel.aspx?moduleName=" + table1 + "&r=" + DateTime.Now.Ticks;
                    }
                    attrHtml = attrHtml.Replace("{首字母大写关联表名}", selModuleUrl);
                }
                BuildByTag b1 = new BuildByTag(BuildType.ForHtmlValue);
                b1.ParseForSwitch标签(ref attrHtml, f1);
                if (isChaZhao(f1))
                {
                    attrHtml = attrHtml.Replace("{字段显示值}", Convert.ToString(finderObj.GetValue(f1.TableName, f1.Desc.FieldCtrlName + "_NAME")));
                }

                sb.Append("<dl><dt>").Append(f1.Desc.ZhName).Append(":</dt><!--").Append(f1.FieldName)
                .Append("--><dd><span>");
                sb.Append(attrHtml);
                sb.Append("</span></dd></dl>");
            }
        }
        catch (Exception ex)
        {
            Cs.Error("34" + ex.ToString());
        }
        return(sb.ToString());
    }
コード例 #14
0
ファイル: ProjectService.cs プロジェクト: Agil13/ide-2019
 public void SaveFile(Cs cS)
 {
     using (Stream fs = new FileStream(cS.Path, FileMode.Truncate, FileAccess.ReadWrite)) {
         using (var sw = new StreamWriter(fs)) {
             sw.Write(cS.Text);
         }
     }
 }
コード例 #15
0
ファイル: EndTurn.cs プロジェクト: gyyfifafans/PBO
 private static void FieldCondition(Cs condition, Field f, Controller c)
 {
     if (f.GetCondition <int>(condition) == c.TurnNumber)
     {
         f.RemoveCondition(condition);
         c.ReportBuilder.ShowLog("De" + condition, f.Team);
     }
 }
コード例 #16
0
 public ResolveResult GetDefaultValueExpression(IType typeRef)
 {
     if (typeRef.Kind == TypeKind.Struct || typeRef.Kind == TypeKind.Enum)
     {
         return(GetValueTypeInitializer(typeRef, Compiler.Project));
     }
     return(Cs.Null());
 }
コード例 #17
0
 /// <summary>
 /// Set User as Admin. this will give him access to Admin page.
 /// </summary>
 public void SetUserAdmin(int userID)
 {
     if (IsAdmin(userID) == false)
     {
         GetUser(userID).IsAdmin = true;
         Cs.SubmitChanges();
     }
 }
コード例 #18
0
ファイル: ConditionalObject.cs プロジェクト: gyyfifafans/PBO
 public bool AddTurnCondition(Cs name, object value = null)
 {
     if (AddCondition(name, value))
     {
         turn.Add(name);
         return(true);
     }
     return(false);
 }
コード例 #19
0
ファイル: ConditionalObject.cs プロジェクト: gyyfifafans/PBO
 public bool AddCondition(Cs name, object value = null)
 {
     if (conditions.ContainsKey(name))
     {
         return(false);
     }
     conditions[name] = value;
     return(true);
 }
コード例 #20
0
ファイル: StateAdded.cs プロジェクト: gyyfifafans/PBO
 private static bool MentalHerb(PokemonProxy pm, Cs condition)
 {
     if (pm.OnboardPokemon.RemoveCondition(condition))
     {
         pm.ShowLogPm("De" + condition);
         return(true);
     }
     return(false);
 }
コード例 #21
0
        public override void sendMessage(string message, string senderName, string receiverName)
        {
            var receiverC = Cs.Where(c => c.name == receiverName).FirstOrDefault();

            if (receiverC != null)
            {
                receiverC.receive(message, senderName);
            }
        }
コード例 #22
0
ファイル: MainForm.cs プロジェクト: Agil13/ide-2019
        private void AddFileIs(TreeNode node, Cs cS)
        {
            var prodNode = new TreeNode(cS.Name)
            {
                ContextMenuStrip = contextMenuStripEditCS
            };

            node.Nodes.Add(prodNode);
        }
コード例 #23
0
ファイル: ProjectService.cs プロジェクト: Agil13/ide-2019
        public TabPage AddPage(Cs cS)
        {
            var tabPage = new TabPage(cS.Name);
            var textBox = new FastColoredTextBox {
                Dock = DockStyle.Fill, Language = Language.CSharp, Text = cS.Text
            };

            tabPage.Controls.Add(textBox);
            return(tabPage);
        }
コード例 #24
0
ファイル: ConditionalObject.cs プロジェクト: gyyfifafans/PBO
        public T GetCondition <T>(Cs name, T defaultValue)
        {
            object o;

            if (conditions.TryGetValue(name, out o) && o is T)
            {
                return((T)o);
            }
            return(defaultValue);
        }
コード例 #25
0
 public CompteConfiguration()
 {
     HasMany <Credit>(s => s.Credits)
     .WithMany(C => (ICollection <Compte>)C.Comptes)
     .Map(Cs =>
     {
         Cs.MapLeftKey("CreditId");
         Cs.MapRightKey("AgenceId");
         Cs.ToTable("AgenceCredit");
     });
 }
コード例 #26
0
        private JsNode Unary(OperatorResolveResult res)
        {
            if (res.UserDefinedOperatorMethod != null && !Sk.UseNativeOperatorOverloads(res.UserDefinedOperatorMethod.DeclaringTypeDefinition))
            {
                var fake = Cs.InvokeMethod(res.UserDefinedOperatorMethod, null, res.Operands[0]);
                return(Visit(fake));
            }

            var isProperty = false;
            var meRes      = res.Operands[0] as MemberResolveResult;

            if (meRes != null && meRes.Member != null && IsEntityFunctionProperty(meRes.Member, res))
            {
                isProperty = true;
            }

            JsExpression node2;

            if (res.OperatorType.IsAny(ExpressionType.Negate, ExpressionType.PreDecrementAssign, ExpressionType.PreIncrementAssign, ExpressionType.Not, ExpressionType.OnesComplement))
            {
                var simpler = res.OperatorType.ExtractCompoundAssignment();
                if (isProperty && simpler != null)
                {
                    var fakeCs = meRes.ShallowClone().Binary(simpler.Value, Cs.Value(1, Project), meRes.Type);
                    node2 = VisitExpression(fakeCs);
                }
                else
                {
                    node2 = new JsPreUnaryExpression {
                        Operator = Visit(res.OperatorType), Right = VisitExpression(res.Operands[0])
                    };
                }
            }
            else if (res.OperatorType.IsAny(ExpressionType.PostIncrementAssign, ExpressionType.PostDecrementAssign, ExpressionType.PreIncrementAssign, ExpressionType.PreDecrementAssign))
            {
                if (isProperty)
                {
                    var simpler = res.OperatorType.ExtractCompoundAssignment();
                    var fakeCs  = meRes.ShallowClone().Binary(simpler.Value, Cs.Value(1, Project), meRes.Type);
                    node2 = VisitExpression(fakeCs);
                }
                else
                {
                    node2 = new JsPostUnaryExpression {
                        Operator = Visit(res.OperatorType), Left = VisitExpression(res.Operands[0])
                    };
                }
            }
            else
            {
                throw new NotImplementedException();
            }
            return(node2);
        }
コード例 #27
0
        public override JsNode _VisitField(IField fld)
        {
            var initializer = GetCreateFieldInitializer(fld);

            if (initializer == null)
            {
                initializer = Cs.Null();
            }
            var node = AstNodeConverter.Visit(initializer);

            return(Js.JsonNameValue(fld.Name, (JsExpression)node));
        }
コード例 #28
0
ファイル: WebGet.cs プロジェクト: linechengchen/m.edianzu.com
        public string GetUrltoHtml2(string uri, Encoding Encoding1)
        {
            if (string.IsNullOrEmpty(uri) || string.IsNullOrEmpty(uri.Trim()))
            {
                return("");
            }
            //wc = new CookieAwareWebClient();
            wc.Encoding = Encoding1;

            //html1 = "";
            //get1(uri);
            //while (html1 == "")
            //{
            //    Wait(100);
            //    //Wait(2000);
            //}
            //return html1;
            Console.WriteLine("Sending an HTTP GET request to " + uri);

            //Application.DoEvents();
            Thread.Sleep(10);
            //Application.DoEvents();
            Stream       st = null;
            StreamReader sr = null;

            try
            {
                st = wc.OpenRead(uri);
                sr = new StreamReader(st);
                string res = sr.ReadToEnd();
                return(res);
            }
            catch (Exception ex1)
            {
                Cs.Error(ex1.ToString());
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
                if (st != null)
                {
                    st.Close();
                }
            }
            Console.WriteLine("HTTP Response is ");

            //Console.WriteLine(res);
            return("");
        }
コード例 #29
0
        public static ITypeDefinition GetDefinitionOrArrayType(this IType ce)
        {
            var def = ce.GetDefinition();

            if (def == null)
            {
                if (ce.Kind == TypeKind.Array)
                {
                    return(Cs.ArrayType(((ArrayType)ce).Compilation));
                }
            }
            return(def);
        }
コード例 #30
0
ファイル: ProjectService.cs プロジェクト: Agil13/ide-2019
        public Cs OpenFile(string path)
        {
            var cS = new Cs();

            using (Stream fs = new FileStream(path, FileMode.Open, FileAccess.ReadWrite)) {
                using (var sr = new StreamReader(fs)) {
                    cS.Name = Path.GetFileName(path);
                    cS.Path = path;
                    cS.Text = sr.ReadToEnd();
                    return(cS);
                }
            }
        }
コード例 #31
0
ファイル: GridColumn.cs プロジェクト: huamanhtuyen/VNACCS
 private void SetState(Cs state, bool value)
 {
     if (value == true)
         _States |= state;
     else
         _States &= ~state;
 }
コード例 #32
0
ファイル: GridColumn.cs プロジェクト: huamanhtuyen/VNACCS
 private bool TestState(Cs state)
 {
     return ((_States & state) == state);
 }