示例#1
0
        internal void mergeJECGTT(JI j, JECAKey key, JECGTT jecFrom, JECGTT jecTo,
                                  Action <GTTI> enqueuePropagateGTTI,
                                  Action <GTTI, GTTI> enqueueMergeGTTI)
        {
            Debug.Assert(jecFrom != jecTo);
            Debug.Assert(jecFrom.jecgtT.SequenceEqual(jecTo.jecgtT));
            Debug.Assert(makeJECGTTKey(j, jecTo.jecgtT) == key);
            if (jecFrom.CompareTo(jecTo) < 0)
            {
                FU.swap(ref jecFrom, ref jecTo);
            }
            gtts.mergeJECInt(j, jecFrom, jecTo, enqueuePropagateGTTI, enqueueMergeGTTI);
#if DEBUG
            if (jecgtTBreakCondition(j, jecTo.jecgtT))
            {
                Debugger.Break();
            }
            if (jecgtTBreakCondition(j, jecFrom.jecgtT))
            {
                Debugger.Break();
            }
#endif
            Debug.Assert(jecTKeyToJECGTT[j][key] == jecFrom || jecTKeyToJECGTT[j][key] == jecTo);
            if (jecTKeyToJECGTT[j][key] == jecFrom)
            {
                removeJECTKeyInt(j, key);
                setJECTKeyInt(j, key, jecTo);
            }
        }
示例#2
0
        public override bool sourcesCompleteGTTINoLGTTs(int gtti)
        {
            var gttd = gtts.getTD(gtti);

            #region gtis
            if (gttd.gtiT.Length > 0)
            {
                foreach (var pgtA in FU.makeOptions((from gti in gttd.gtiT select pu.depthFilterStrict(gts.getTD(gti).pgts)).ToArray()))
                {
                    GTT pgtt;
                    if (su.termRepository.tryGetGTT(pgtA, out pgtt))
                    {
                        if (pu.hasGTT(pgtt))
                        {
                            Debug.Assert(pu.upToDate(pgtt));
                            Debug.Assert(gttd.hasPGTT(pgtt) || pu.gttRevision(pgtt) >= su.predecessorLastRevision);
                        }
                        else
                        {
                            Debug.Assert(pu.hasRGTT(pgtt));
                        }
                    }
                }
            }
            #endregion gtis
            #region pgtts
            foreach (var pgtt in gttd.pgtts)
            {
                Debug.Assert(pu.upToDate(pgtt));
            }
            #endregion pgtts

            return(true);
        }
示例#3
0
        protected CC(IEnumerable <IL> atoms)
        {
            this.ils = atoms.ToList(); //Atoms should be sorted - cannot have explicit SortedSet because T is not an out parameter

            freeVariables        = FU.union(from a in this.ils select a.freeVariables);
            orderedFreeVariables = new List <LVar>();
            foreach (var a in atoms)
            {
                foreach (var fv in a.freeVariables)
                {
                    if (!orderedFreeVariables.Contains(fv))
                    {
                        orderedFreeVariables.Add(fv);
                    }
                }
            }

            varMap = new Dictionary <LVar, string>();
            foreach (var fv in orderedFreeVariables)
            {
                varMap[fv] = "v" + varMap.Count().ToString();
            }
            stringNCache = ToStringNInt();
            hashCache    = stringNCache.GetHashCode();
        }
示例#4
0
        /// <summary>
        /// 将十六进制数组字符串转换为十六进制数组
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static byte[] ConvertByteString(string text)
        {
            var buffer = new byte[text.Length / 2];

            for (var i = 0; i < buffer.Length; i++)
            {
                buffer[i] = (byte)((FU.ConvertHexCharToByte(text[i * 2]) << 4) + FU.ConvertHexCharToByte(text[i * 2 + 1]));
            }

            return(buffer);
        }
        protected void enqueueMergeGTI(GTI gti1R, GTI gti2R)
        {
            #region consistency
            var gtd1R = getGTD(gti1R);
            var gtd2R = getGTD(gti2R);
            Debug.Assert(gtd1R.type == null || gtd2R.type == null || gtd1R.type.isEquivalent(gtd2R.type));
            #endregion consistency

            var gti1 = gti1R;
            while (gtiMergeToMap.ContainsKey(gti1))
            {
                gti1 = gtiMergeToMap[gti1];
            }
            var gti2 = gti2R;
            while (gtiMergeToMap.ContainsKey(gti2))
            {
                gti2 = gtiMergeToMap[gti2];
            }
            if (gti1 == gti2)
            {
                return;
            }
            if (gti1 > gti2)
            {
                FU.swap(ref gti1, ref gti2);
            }
            if (gti1 == currentlyMergingFromGTI)
            {
                gti1 = currentlyMergingToGTI;
            }
            if (gti2 == currentlyMergingFromGTI && gti1 == currentlyMergingToGTI)
            {
                return;
            }
            Debug.Assert(!gtiMergeMap.ContainsKey(gti1));
            Debug.Assert(!gtiMergeMap.ContainsKey(gti2));
            Debug.Assert(!gtiMergeToMap.ContainsKey(gti1));
            Debug.Assert(!gtiMergeToMap.ContainsKey(gti2));
#if DEBUG
//            if (getGTD(gti1).lgts.Any(isIt) || getGTD(gti2).lgts.Any(isIt))
//                Debugger.Break();
//            if (isItGTI(gti1) || isItGTI(gti2))
//                Debugger.Break();
#endif
            gtiMergeToMap[gti2] = gti1;
        }
示例#6
0
 protected void BtnGuardar_Click(object sender, EventArgs e)
 {
     //decimal costo = txtCosto.Text != "" && txtCosto != null ? Convert.ToDecimal(txtCosto.Text) : 0;
     try
     {
         if (FU.HasFile)
         {
             string ext = System.IO.Path.GetExtension(FU.FileName);
             ext = ext.ToLower();
             FU.SaveAs(Server.MapPath("~/img/" + FU.FileName));
             Response.Write("Se subió el archivo");
         }
         Proyecto proye = new Proyecto()
         {
             //id_proyecto = Convert.ToInt32(txtId.Value),
             nombre_proyecto = txtNombre.Text,
             desc_proyecto   = txtDescripcion.Text,
             img_proyecto    = FU.FileName,
             fecha_proyecto  = Convert.ToDateTime(txtDate.Text),
             costo_proyecto  = Convert.ToInt32(txtCosto.Text)
         };
         if (txtId.Value == "" || txtId.Value == null)
         {
             new BusGlobal().CreateProyecto(proye);
             Response.Redirect("Proyectos.aspx", false);
         }
         else
         {
             proye.id_proyecto = Convert.ToInt32(txtId.Value);
             new BusGlobal().UpdateProyecto(proye);
             Response.Redirect("Proyectos.aspx", false);
         }
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
示例#7
0
    protected void butUpload_Click(object sender, EventArgs e)
    {
        int c = 0;

        if (FU.HasFile)
        {
            string s  = FU.FileName;
            int    i  = s.Length;
            string sa = s.Substring((i - 4), 4);
            cmd.CommandText = "select count(T_code) from Course_Material where T_code='" + txtcode.Text + "'";
            con.Open();

            if (cmd.ExecuteScalar() == null)
            {
                c = 1;
            }
            else
            {
                c = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
            }
            string s1 = txtcode.Text + Convert.ToString(c) + sa;
            FU.SaveAs(Server.MapPath("~/") + "/Materials/" + s1);
            cmd.Connection  = con;
            cmd.CommandText = "Insert into Course_Material values('" + txtcode.Text + "','" + s1 + "')";
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd.ExecuteNonQuery();
            txtcode.Text = "";
            txtcrs.Text  = "";
            txtSub.Text  = "";
            txtYSem.Text = "";
            con.Close();
        }
    }
示例#8
0
        public override bool sourcesCompleteGTTINoLGTTs(int gtti)
        {
            base.sourcesCompleteGTTINoLGTTs(gtti);
            var gttd = gtts.getTD(gtti);

            #region gtiT
            if (gttd.gtiT.Length > 0)
            {
                #region gtis
                foreach (var j in js)
                {
                    var pu = pus[j];
                    foreach (var pgtA in FU.makeOptions((from gti in gttd.gtiT select pu.depthFilterStrict(from pgt in gts.getTD(gti).jgts(j) select pgt)).ToArray()))
                    {
                        GTT pgtt;
                        if (ju.termRepository.tryGetGTT(pgtA, out pgtt))
                        {
                            if (pu.hasGTT(pgtt))
                            {
                                Debug.Assert(pu.upToDate(pgtt));
                                Debug.Assert(gttd.hasJGTT(j, pgtt) || pu.gttRevision(pgtt) >= ju.predecessorLastRevisions[j]);
                            }
                            else
                            {
                                Debug.Assert(pu.hasRGTT(pgtt));
                            }
                        }
                        else
                        {
                            Debug.Assert(false);
                        }
                    }
                }
                #endregion gtis
            }
            #endregion gtiT

            #region jgtts
            foreach (var j in js)
            {
                foreach (var jgtt in gttd.jgtts(j))
                {
                    Debug.Assert(pus[j].upToDate(jgtt));
                }
            }
            #endregion jgtts

            var jgttsA = (from j in js select new HashSet <GTT>(gtts.getJTs(j, gtti))).ToArray();

            #region empty gtt
            if (getGTTIGTIs(gtti).Count == 0)
            {
                foreach (var j in js)
                {
                    Debug.Assert(jgttsA[j].Count == 1 && jgttsA[j].Contains(ju.emptyGTT));
                }
            }
            #endregion empty gtt

            #region sources
            if (ju.jn == 2)
            {
                foreach (var j in js)
                {
                    var ju = this.ju.pus[j];
                    if (getGTTIGTIs(gtti).Count > 0)
                    {
                        var jgtsA  = ju.depthFilterStrict(from gt in getGTTIGTIs(gtti) select gts.getJTs(j, gt));
                        var pjgtts = from jgtA in FU.makeOptions(jgtsA) select ju.getGTT(jgtA);

                        foreach (var pjgtt in pjgtts)
                        {
                            if (!ju.hasGTT(pjgtt))
                            {
                                Debug.Assert(ju.hasRGTT(pjgtt));
                            }
                            else
                            if (this.ju.predecessorLastRevisions[j] > ju.gttRevision(pjgtt))
                            {
                                Debug.Assert(jgttsA[j].Contains(pjgtt));
                            }
                        }
                    }
                }
            }
            #endregion sources
            return(true);
        }
示例#9
0
        public override bool sourcesCompleteGTINoLGTs(int gti)
        {
            base.sourcesCompleteGTINoLGTs(gti);
            var gtd = gts.getTD(gti);

            #region gfas
            foreach (var gfa in gtd.gfas)
            {
                foreach (var j in js)
                {
                    var pu = pus[j];
                    if (pu.inScope(gfa.Item1))
                    {
                        var f    = gfa.Item1;
                        var gtti = gfa.Item2;
                        var gttd = gtts.getTD(gtti);
                        foreach (var pgtt in gttd.jgtts(j))
                        {
                            if (pu.inDepthBoundStrict(pgtt))
                            {
                                GFA pgfa;
                                if (pu.tryGetGFA(f, pgtt, out pgfa))
                                {
                                    Debug.Assert(gtd.hasJGT(j, pgfa.gt) || pu.gtRevision(pgfa.gt) >= ju.predecessorLastRevisions[j]);
                                }
                                else
                                {
                                    Debug.Assert(pu.hasRGFA(f, pgtt));
                                }
                            }
                        }
                    }
                }
            }
            #endregion gfas

            #region pgts
            foreach (var j in js)
            {
                foreach (var jgt in gtd.jgts(j))
                {
                    Debug.Assert(pus[j].upToDate(jgt));
                }
            }
            if (gtd.depth > minDepth)
            {
                var gfaMap = new Dictionary <Function, ISet <GTT>[]>();
                foreach (var j in js)
                {
                    foreach (var pgt in gtd.jgts(j))
                    {
                        foreach (var pgfa in pgt.gfas)
                        {
                            if (ju.inScope(pgfa.function))
                            {
                                gfaMap.insert(jn, pgfa.function, j, pgfa.gtt);
                            }
                        }
                    }
                }
                foreach (var kv in gfaMap)
                {
                    foreach (var jgttA in FU.makeOptions((from j in js select kv.Value[j]).ToArray()))
                    {
                        Debug.Assert(gtd.hasGFA(kv.Key, getJGTTAGTTI(jgttA)));
                    }
                }
            }
            #endregion pgts
            return(true);
        }
示例#10
0
        protected override sealed void propagateUsed(JGTSD gtd, ISet <JGTSD> todoGTDs, ISet <JGTSD> usedGTDs, ISet <JGTTSD> todoGTTDs, ISet <JGTTSD> usedGTTDs)
        {
            if (gtd.depth != topDepth && gtd.depth > minDepth)
            {
                if (jn == 1)
                {
                    foreach (var pgt in gtd.jgts(0))
                    {
                        foreach (var pgfa in pgt.gfas)
                        {
                            if (ju.inScope(pgfa.function))
                            {
                                var gttds = from gtti in gtts.getJTJEC(0, pgfa.gtt).tis select gtts.getTD(gtti);

                                foreach (var gttd in gttds)
                                {
                                    if (usedGTTDs.Add(gttd))
                                    {
                                        todoGTTDs.Add(gttd);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Debug.Assert(jn == 2);
                    #region jgtxjgt
                    var jgtA = (from j in js select gtd.jgts(j)).ToArray();
                    var jfA  = (from j in js select new HashSet <Function>(from jgt in jgtA[j] from f in jgt.gfasByFunction.Keys select f)).ToArray();
                    foreach (var f in FU.intersection(jfA))
                    {
                        foreach (var jecgttT in
                                 FU.makeOptions(
                                     (from j in js
                                      select new HashSet <JECGTT>(
                                          from jgt in jgtA[j] from jgfa in jgt.getGFAsByFunction(f) select gtts.getJTJEC(j, jgfa.gtt))).ToArray()))
                        {
                            var gttd = gtts.getJECATD(jecgttT);
                            if (usedGTTDs.Add(gttd))
                            {
                                todoGTTDs.Add(gttd);
                            }
                        }
                    }
                    #endregion jgtxjgt
                    #region jgtxgfa + gfaxjgt
                    foreach (var j in js)
                    {
                        foreach (var f in jfA[j])
                        {
                            if (gtd.hasGFAFunction(f))
                            {
                                foreach (var jecgttT in
                                         FU.makeOptions(
                                             (from j2 in js
                                              select j == j2
                                         ? new HashSet <JECGTT>(from jgt in jgtA[j2] from jgfa in jgt.getGFAsByFunction(f) select gtts.getJTJEC(j2, jgfa.gtt))
                                         : new HashSet <JECGTT>(from gtti in gtd.getGFAs(f) select gtts.getTD(gtti).jecA[j2])
                                             ).ToArray()))
                                {
                                    var gttd = gtts.getJECATD(jecgttT);
                                    if (usedGTTDs.Add(gttd))
                                    {
                                        todoGTTDs.Add(gttd);
                                    }
                                }
                            }
                        }
                    }
                    #endregion jgtxgfa + gfaxjgt
                }
            }
            base.propagateUsed(gtd, todoGTDs, usedGTDs, todoGTTDs, usedGTTDs);
        }
    protected void Submit_Click(object sender, EventArgs e)
    {
        Product product;

        Labeloldprod.Text = "";
        try
        {
            string productName      = productNameTB.Text;
            double productPrice     = Convert.ToDouble(productPriceTB.Text);
            string CategoryName     = productCategoryDDL.SelectedValue;
            int    productInventory = Convert.ToInt32(productInventoryTB.Text);
            string name             = FU.FileName;
            string ProductFilePath  = "";
            string SavedFileName    = "";

            if ((name == "" && Session["oldProduct"] != null))
            {
                ProductFilePath = productImg.ImageUrl;
            }
            else
            {
                SavedFileName   = Server.MapPath(".") + "/images/" + name;
                ProductFilePath = "images/" + name;
                FU.SaveAs(SavedFileName);
            }


            bool productStatus;
            if (statusCB.Checked == true)
            {
                productStatus = true;
            }
            else
            {
                productStatus = false;
            }
            if (Session["oldProduct"] != null)
            {
                product = new Product(productName, productPrice, CategoryName, productInventory, ProductFilePath, productStatus, (int)Session["product_id"]);
            }
            else
            {
                product = new Product(productName, productPrice, CategoryName, productInventory, ProductFilePath, productStatus);
            }
        }
        catch (Exception ex)
        {
            messageLBL.Text = "invalid argoments inserted " + ex.Message;
            return;
        }
        try
        {
            if (Session["oldProduct"] != null)
            {
                product.updateTable();
                try
                {
                    product.updateDatabase();
                    Session["oldProduct"] = null;
                    messageLBL.Text       = "you changed " + productNameTB.Text + " product successfully";
                }
                catch (Exception ex)
                {
                    Response.Write("Error updating the products database " + ex.Message);
                }
            }
            else
            {
                int numEffected = product.insertProduct();
                messageLBL.Text = "you added " + numEffected.ToString() + " new product";
            }
        }
        catch (Exception ex)
        {
            messageLBL.Text = "An error accured " + ex.Message;
        }

        productNameTB.Text                  = "";
        productPriceTB.Text                 = "";
        productInventoryTB.Text             = "";
        statusCB.Checked                    = false;
        productImg.Visible                  = false;
        RequiredFileUploadValidator.Enabled = true;
    }
    protected void butSubmit_Click(object sender, EventArgs e)
    {
        if (txtAdd.Text != "" && txtAmt.Text != "" && txtCD.Text != "" && txtCno.Text != "" && txtEadd.Text != "" && txtFname.Text != "" && txtLsp.Text != "" && txtQlf.Text != "" && txtSname.Text != "")
        {
            string Course_ID = "";

            if (rbBCA.Checked == true)
            {
                Course_ID = "BCS001";
            }
            if (rbBtech.Checked == true)
            {
                Course_ID = "BT002";
            }
            if (rbMCA.Checked == true)
            {
                Course_ID = "MCS003";
            }
            if (rbMtech.Checked == true)
            {
                Course_ID = "MT004";
            }
            String sex = "";
            if (rbMle.Checked == true)
            {
                sex = "Male";
            }
            if (rbFml.Checked == true)
            {
                sex = "Male";
            }
            String Status = "";
            if (rbMd.Checked == true)
            {
                Status = "Married";
            }
            if (rbUm.Checked == true)
            {
                Status = "Unmarried";
            }
            string mode = "";
            if (rbCash.Checked == true)
            {
                mode = "Cash";
            }
            if (rbChk.Checked == true)
            {
                mode = "Check";
            }
            if (rbdd.Checked == true)
            {
                mode = "DD";
            }

            int RegNo;
            cmd.CommandText = "select max (Reg_No) from Student_Registration";
            con.Open();
            if (cmd.ExecuteScalar() == DBNull.Value)
            {
                RegNo = 1456;
            }
            else
            {
                RegNo = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
            }


            int c = 0;
            if (FU.HasFile)
            {
                string s  = FU.FileName;
                int    i  = s.Length;
                string sa = s.Substring((i - 4), 4);
                cmd.CommandText = "select count(Sname) from Student_Registration where Sname='" + txtSname.Text + "'";
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                if (cmd.ExecuteScalar() == null)
                {
                    c = 1;
                }
                else
                {
                    c = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                }
                string s1 = txtSname.Text + Convert.ToString(c) + sa;
                FU.SaveAs(Server.MapPath("~/") + "/Students Photo/" + s1);

                cmd.Connection  = con;
                cmd.CommandText = "Insert into Student_Registration values(" + RegNo + ",'" + Course_ID + "','" + txtSname.Text + "','" + (mm1.SelectedIndex + 1) + "/" + dd1.Text + "/" + yy1.Text + "','" + sex + "','" + Status + "'," + txtCno.Text + ",'" + txtQlf.Text + "','" + txtLsp.Text + "','" + txtFname.Text + "','" + (mm3.SelectedIndex + 1) + "/" + dd3.Text + "/" + yy3.Text + "','" + txtAdd.Text + "','" + txtEadd.Text + "','" + mode + "','" + txtCD.Text + "'," + txtAmt.Text + ",'" + (mm2.SelectedIndex + 1) + "/" + dd2.Text + "/" + yy2.Text + "','" + s1 + "')";
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                cmd.ExecuteNonQuery();
                con.Close();
                clear();
                Response.Redirect("StudentApp.aspx?Snm=" + txtSname.Text);
                txtSname.Text = "";
            }
        }
        else
        {
            lblmsg.Text = "Any Field Cannot be Blank!";
        }
    }
示例#13
0
        public override bool sourcesCompleteGTINoLGTs(int gti)
        {
            var gtd = gts.getTD(gti);

            #region gfas
            foreach (var gfa in gtd.gfas)
            {
                if (pu.inScope(gfa.Item1))
                {
                    var f    = gfa.Item1;
                    var gtti = gfa.Item2;
                    var gttd = gtts.getTD(gtti);
                    foreach (var pgtt in gttd.pgtts)
                    {
                        if (pu.inDepthBoundStrict(pgtt))
                        {
                            GFA pgfa;
                            if (pu.tryGetGFA(f, pgtt, out pgfa))
                            {
                                Debug.Assert(gtd.hasPGT(pgfa.gt) || pu.gtRevision(pgfa.gt) >= su.predecessorLastRevision);
                            }
                            else
                            {
                                Debug.Assert(pu.hasRGFA(f, pgtt));
                            }
                        }
                    }
                }
            }
            #endregion gfas

            #region pgts
            foreach (var pgt in gtd.pgts)
            {
                Debug.Assert(pu.upToDate(pgt));
            }
            if (gtd.depth > minDepth)
            {
                foreach (var pgt in gtd.pgts)
                {
                    Debug.Assert(pu.upToDate(pgt));
                    foreach (var pgfa in pgt.gfas)
                    {
                        if (su.inScope(pgfa.function) && pu.gttRevision(pgfa.gtt) < su.predecessorLastRevision)
                        {
                            Debug.Assert(gtd.hasGFA(pgfa.function, gtts.getPTTI(pgfa.gtt)));
                        }
                    }
                }
            }
            #endregion pgts

            #region rgtts
            foreach (var lgt in gtd.lgts)
            {
                foreach (var rgtt in su.getGTRGTTs(lgt))
                {
                    var pgtsT = (from gt in rgtt.gtT select pu.depthFilterStrict(gts.getLTTD(gt).pgts)).ToArray();
                    var pgtTs = FU.makeOptions(pgtsT);
                    var pgtts = (from pgtT in pgtTs select pu.getGTT(pgtT));
                    foreach (var pgtt in pgtts)
                    {
                        Debug.Assert(pu.hasGTT(pgtt) || pu.hasRGTT(pgtt));
                    }
                }
            }
            #endregion rgtts

            return(true);
        }