private void UpdateEntityMattersCourses(string[] selectedMatters, cEntity entityToUpdate)
        {
            if (selectedMatters == null)
            {
                entityToUpdate.Matters = new List <cMatter>();
                return;
            }

            var selectedMattersHS = new HashSet <string>(selectedMatters);
            var entityMatters     = new HashSet <string>
                                        (entityToUpdate.Matters.Select(m => m.ID));

            foreach (var matter in db.Matters)
            {
                if (selectedMattersHS.Contains(matter.ID.ToString()))
                {
                    if (!entityMatters.Contains(matter.ID))
                    {
                        entityToUpdate.Matters.Add(matter);
                    }
                }
                else
                {
                    if (entityMatters.Contains(matter.ID))
                    {
                        entityToUpdate.Matters.Remove(matter);
                    }
                }
            }
        }
Esempio n. 2
0
    protected void linedraw()
    {
        Chart1.ChartAreas["ChartArea"].Area3DStyle.Enable3D = false;
        //    double[] yvalues = { 10, 20.65, 30, 45.75, 85.5, 94.5, 25.2 };
        //   string[] xvalues = { "Computer Science", "Information Technology", "Mechanical", "Electronics", "EEE", "CIVIL", "TC" };

        cEntity cee = new cEntity(); int keeee = 0;
        string[] dat = new string[30];
        double[] ene = new double[30];
        for (int i = 0; i < variables.AddressListnew.Count; i++)
        {
            cee = variables.AddressListnew.ElementAt(i);
            if (cee.devicename.Equals(variables.deviceName))
            {
                dat[keeee] = cee.datetime;
                ene[keeee++] = Math.Abs(Convert.ToInt32(Convert.ToDouble(cee.energy2)) - (Convert.ToInt32(Convert.ToDouble(cee.energy1))));
            }
        }
        double[] yvalues = new double[keeee];
        string[] xvalues = new string[keeee];
        for (int k = 0; k < keeee; k++)
        {
            xvalues[k] = dat[k];
            yvalues[k] = ene[k];
        }
        Chart1.Series["Series1"].Points.DataBindXY(xvalues, yvalues);
        Chart1.Series["Series1"].Color = System.Drawing.Color.Green;
        Chart1.Series["Series1"].BorderColor = System.Drawing.Color.Yellow;
        Chart1.Series["Series1"].ChartType = SeriesChartType.Line;
        Chart1.Series["Series1"].IsValueShownAsLabel = true;
    }
        public ActionResult DeleteConfirmed(int id)
        {
            cEntity cEntity = db.Entities.Find(id);

            db.Entities.Remove(cEntity);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: cEntity/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            cEntity cEntity = db.Entities.Find(id);

            if (cEntity == null)
            {
                return(HttpNotFound());
            }
            return(View(cEntity));
        }
        private void PopulateAssignedMatterData(cEntity entity)
        {
            var allMatters    = db.Matters;
            var entityMatters = new HashSet <string>(entity.Matters.Select(m => m.ID));
            var viewModel     = new List <AssignedMatterViewModel>();

            foreach (var matter in allMatters)
            {
                viewModel.Add(new AssignedMatterViewModel
                {
                    MatterNumber      = matter.ID,
                    MatterDescription = matter.Description,
                    Assigned          = entityMatters.Contains(matter.ID)
                });
            }
            ViewBag.Matters = viewModel;
        }
        // GET: cEntity/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            cEntity entity = db.Entities
                             .Include(i => i.Matters)
                             .Where(i => i.ID == id)
                             .Single();

            PopulateAssignedMatterData(entity);

            if (entity == null)
            {
                return(HttpNotFound());
            }

            return(View(entity));
        }
        public ActionResult Create([Bind(Include = "ID,CDDContact_Name,CDDContact_TelNo,CDDContact_Email,ComplianceSignOff_Name,ComplianceSignOff_Date,CDDStatus")] cEntity cEntity)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entities.Add(cEntity);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (RetryLimitExceededException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.)
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
            }


            return(View(cEntity));
        }
Esempio n. 8
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        cun = customer.Text.ToLower().Trim() ;

           hr = idh.Text.Trim();
        string tableName=cun + hr;
        customer.Text = cun;

        if (Convert.ToInt32(hr) >= 0 && Convert.ToInt32(hr) <= 23)
        {

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
               ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
            CloudTableClient tableClient1 = storageAccount.CreateCloudTableClient();
            CloudTable table12 = null;
            variables.AddressListnew = new List<cEntity>();
            try
            {

                table12 = tableClient1.GetTableReference(tableName);

                if (!(table12.Exists()))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Table Does not exist');", true);
                    return;
                }

                TableQuery<cEntity> query1 = new TableQuery<cEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.NotEqual, "xyzzzz"));

                foreach (cEntity entity in table12.ExecuteQuery(query1))
                {
                    cEntity ce = new cEntity();
                    ce.PartitionKey = entity.PartitionKey;
                    ce.RowKey = entity.RowKey;
                    ce.id = entity.id;
                    ce.devicefunction = entity.devicefunction;
                    ce.devicename = entity.devicename;
                    ce.devicetype = entity.devicetype;
                    ce.devtabid = entity.devtabid;
                    ce.ep = entity.ep;
                    ce.vendorname = entity.vendorname;
                    ce.IEEE = entity.IEEE;
                    ce.datetime = entity.datetime;
                    ce.energy1 = entity.energy1;
                    ce.energy2 = entity.energy2;
                    variables.AddressListnew.Add(ce);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Table does not exist');", true);
                return;
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Hour input out of range');", true);
            return;
        }
                  cEntity c =  variables.AddressListnew[0];
                  variables.realieee[0] = c.IEEE;
                  variables.realep[0] = c.ep;
                  cEntity cee = new cEntity();
                  int x, y, flag = 0;
                  for (x = 1; x <  variables.AddressListnew.Count; x++)
                  {
                      flag = 0;
                      for (y = 0; y < variables.count; y++)
                      {
                          cee = variables.AddressListnew.ElementAt(x);
                          if (cee.IEEE.Equals(variables.realieee[y]) && cee.ep.Equals(variables.realep[y]))
                          {
                              { flag = 1; break; }
                          }
                      }
                      if (flag == 0)
                      {
                          variables.realieee[variables.count] = cee.IEEE;
                          variables.realep[variables.count] = cee.ep;
                          variables.count++;
                      }
                  }

                  string display = "";
                  for (int i = 0; i < variables.count; i++)
                  {
                      display += variables.realieee[i] + "  " + variables.realep[i] + "\n";

                  }

                  //custPass.Text = display;
                  Server.Transfer("Devices.aspx", true);

        //      Server.Transfer("Devices.aspx", true);
    }