public ActionResult DeleteConfirmed(int id)
        {
            SrcInfo srcInfo = db.SrcInfo.Find(id);

            db.SrcInfo.Remove(srcInfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,type,websitename")] SrcInfo srcInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(srcInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(srcInfo));
 }
        public ActionResult Create([Bind(Include = "id,type,websitename")] SrcInfo srcInfo)
        {
            if (ModelState.IsValid)
            {
                db.SrcInfo.Add(srcInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(srcInfo));
        }
        // GET: SrcInfoes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SrcInfo srcInfo = db.SrcInfo.Find(id);

            if (srcInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(srcInfo));
        }
Esempio n. 5
0
        TargetBlendDesc GetTargetBlendDescImpl(SrcInfo info)
        {
            TargetBlendDesc result;

            result.blendEnable     = false;
            result.color.srcBlend  = D3D11_BLEND.D3D11_BLEND_ONE;
            result.color.destBlend = D3D11_BLEND.D3D11_BLEND_ZERO;
            result.color.op        = D3D11_BLEND_OP.D3D11_BLEND_OP_ADD;
            result.alpha.srcBlend  = D3D11_BLEND.D3D11_BLEND_ONE;
            result.alpha.destBlend = D3D11_BLEND.D3D11_BLEND_ZERO;
            result.alpha.op        = D3D11_BLEND_OP.D3D11_BLEND_OP_ADD;
            result.writeMask       = (UInt32)D3D11_COLOR_WRITE_ENABLE.D3D11_COLOR_WRITE_ENABLE_ALL;
            return(result);
        }
Esempio n. 6
0
        public ResultEnumerator(ResultInfo[] results, string[][] outputFields, string[] outFieldsOrder, int[] keyFields)
        {
            int n = results.Length;

            System.Diagnostics.Trace.Assert(n == outputFields.Length);
            var allFields = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase);

            this.outFieldsNdx = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase);
            var valuesDependenciesDict = new Dictionary <int, List <int> >();

            for (int i = 0; i < outFieldsOrder.Length; i++)
            {
                outFieldsNdx[outFieldsOrder[i]] = -1;
            }
            srcInfos = new SrcInfo[n];
            for (int i = 0; i < n; i++)
            {
                var src     = results[i];
                var key2loc = src.key2ndx;
                // loc2glb
                var loc2glb = new int[key2loc.Count];
                foreach (var pair in key2loc)
                {
                    var key    = pair.Key;
                    var locNdx = pair.Value;
                    int glbNdx;
                    if (!allFields.TryGetValue(key, out glbNdx))
                    {
                        glbNdx = allFields.Count;
                        allFields.Add(key, glbNdx);
                    }
                    loc2glb[locNdx] = glbNdx;
                }
                var fi = src.funcInfo;
                var si = new SrcInfo()
                {
                    loc2glb = loc2glb, data = src.data
                };
                // pureIns
                {
                    var pi  = fi.pureIns;
                    var pig = new List <int>(pi.Length);
                    for (int j = 0; j < pi.Length; j++)
                    {
                        int k;
                        if (allFields.TryGetValue(pi[j], out k))
                        {
                            pig.Add(k);
                        }
                    }
                    si.pureInsGlb = pig.ToArray();
                }
                // inOuts
                {
                    var io = fi.inOuts;
                    si.inOuts = new int[io.Length];
                    for (int j = io.Length - 1; j >= 0; j--)
                    {
                        si.inOuts[j] = key2loc[io[j]];
                    }
                    Array.Sort <int>(si.inOuts);
                }
                // pureOuts
                {
                    var po = fi.pureOuts;
                    si.pureOuts = new int[po.Length];
                    var extKeysGlb = new Dictionary <int, bool>();
                    for (int j = po.Length - 1; j >= 0; j--)
                    {
                        int loc = key2loc[po[j]];
                        si.pureOuts[j] = loc;
                        int glb = loc2glb[loc];
                        // update dependencies info
                        List <int> lst;
                        if (!valuesDependenciesDict.TryGetValue(glb, out lst))
                        {
                            lst = new List <int>();
                            valuesDependenciesDict.Add(glb, lst);
                        }
                        foreach (var s in fi.inputs)
                        {
                            int k;
                            if (!allFields.TryGetValue(s, out k))
                            {
                                continue;
                            }
                            if (!lst.Contains(k))
                            {
                                lst.Add(k);
                            }
                        }
                    }
                    Array.Sort <int>(si.pureOuts);
                    si.extKeysGlb = fi.inputs.SelectMany(
                        s =>
                    {
                        int k;
                        List <int> lst;
                        if (allFields.TryGetValue(s, out k) && valuesDependenciesDict.TryGetValue(k, out lst))
                        {
                            return(lst);
                        }
                        else
                        {
                            return(Enumerable.Empty <int>());
                        }
                    }).Distinct().OrderBy(k => k).ToArray();
                }
                // outputs
                {
                    si.outputs = new int[fi.outputs.Length];
                    for (int j = 0; j < si.outputs.Length; j++)
                    {
                        si.outputs[j] = j;
                    }
                }
                // results
                {
                    var of = outputFields[i];
                    si.results = new int[of.Length];
                    for (int j = 0; j < of.Length; j++)
                    {
                        var key = of[j];
                        int loc = key2loc[key];
                        si.results[j] = loc;
                        int glb;
                        if (outFieldsNdx.TryGetValue(key, out glb))
                        {
                            if (glb < 0)
                            {
                                glb = loc2glb[loc];
                                outFieldsNdx[key] = glb;
                            }
                            else
                            {
                                throw new ArgumentException("Duplicated result field specified: " + key);
                            }
                        }
                        else
                        {
                            System.Diagnostics.Trace.Assert(false, "Key or alias not found in outFieldsNdx: " + key);
                        }
                    }
                }
                // save
                srcInfos[i] = si;
            }
            //
            if (outFieldsNdx.Count != outFieldsOrder.Length)
            {
                System.Diagnostics.Trace.Assert(false);
            }
            this.resColumns = new int[outFieldsNdx.Count];
            for (int i = resColumns.Length - 1; i >= 0; i--)
            {
                int k;
                var s = outFieldsOrder[i];
                if (!outFieldsNdx.TryGetValue(s, out k))
                {
                    k = -1;
                }
                if (k < 0)
                {
                    throw new KeyNotFoundException();
                }
                resColumns[i] = k;
            }
            //
            this.allFields = allFields.OrderBy(pair => pair.Value).Select(pair => pair.Key).ToArray();
            // propagate results activity
            var activeFields = new bool[allFields.Count];

            for (int i = srcInfos.Length - 1; i >= 0; i--)
            {
                var si = srcInfos[i];
                if (si.loc2glb == null)
                {
                    continue;
                }
                bool active = (si.results.Length > 0) && (si.data.Count > 0);
                if (!active)
                {
                    // check out fields usage
                    foreach (int j in si.outputs)
                    {
                        if (activeFields[si.loc2glb[j]])
                        {   // j-th field value is marked as used in joining
                            active = true;
                            break;
                        }
                    }
                }
                if (active != si.active)
                {   // mark key fields as active (must be used in joining)
                    foreach (int loc in si.inOuts)
                    {
                        activeFields[si.loc2glb[loc]] = true;
                    }
                    foreach (int glb in si.pureInsGlb)
                    {
                        activeFields[glb] = true;
                    }
                    srcInfos[i].active = true;
                }
            }
            if (keyFields != null)
            {
                foreach (var i in keyFields)
                {
                    resColumns[i] = -Math.Abs(resColumns[i] + 1);
                }
            }
        }
 TargetBlendDesc GetTargetBlendDescImpl(SrcInfo info)
 {
     TargetBlendDesc result;
     result.blendEnable = false;
     result.color.srcBlend = D3D11_BLEND.D3D11_BLEND_ONE;
     result.color.destBlend = D3D11_BLEND.D3D11_BLEND_ZERO;
     result.color.op = D3D11_BLEND_OP.D3D11_BLEND_OP_ADD;
     result.alpha.srcBlend = D3D11_BLEND.D3D11_BLEND_ONE;
     result.alpha.destBlend = D3D11_BLEND.D3D11_BLEND_ZERO;
     result.alpha.op = D3D11_BLEND_OP.D3D11_BLEND_OP_ADD;
     result.writeMask = (UInt32)D3D11_COLOR_WRITE_ENABLE.D3D11_COLOR_WRITE_ENABLE_ALL;
     return result;
 }
 D3D11_BLEND GetFactorBlendDescImpl(
     SrcInfo info,
     AttrCase channel)
 {
     return D3D11_BLEND.D3D11_BLEND_ONE;
 }
Esempio n. 9
0
 D3D11_BLEND GetFactorBlendDescImpl(
     SrcInfo info,
     AttrCase channel)
 {
     return(D3D11_BLEND.D3D11_BLEND_ONE);
 }