Пример #1
0
        public void AddAuths()
        {
            var auths = new Auths();

            foreach (var item in auths.List)
            {
                var doc = GetSubjectDocByUuid(item[2]);

                //doc.externalAuthorityUri = item[0];
                doc.substrings[0].externalAuthorityUri = item[0];
                doc.substrings[1].externalAuthorityUri = item[1];
                //doc.substrings[2].externalAuthorityUri = item[2];
                //doc.substrings[3].externalAuthorityUri = item[3];
                //doc.substrings[4].externalAuthorityUri = item[4];

                //doc.substrings[2].authoritativeLabel = item[0];
                //doc.authoritativeLabel = item[1];


                var request = new RestRequest($"subject_authority/{doc._id}/", Method.PUT, DataFormat.Json);
                var json    = JsonConvert.SerializeObject(doc, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                request.AddJsonBody(json);
                _client.Execute(request);
            }
        }
Пример #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            EmpBL.EmpBusiness eb = new EmpBL.EmpBusiness();
            Auths             a  = new Auths();
            Employee          ee = a.getEmpOName(TextBox2.Text);

            if (ee.EmpId == 0)
            {
                Label6.Visible = true;
            }
            else
            {
                int i            = eb.getSalaryForDays(ee.EmpId, Convert.ToInt32(ddlMonth.SelectedValue));
                int totalDays    = DateTime.DaysInMonth(2014, Convert.ToInt32(ddlMonth.SelectedValue));
                int leavesLeft   = totalDays - i;
                int attendedDays = a.getNoofDaysAttendedMonth(ee.EmpId, Convert.ToInt32(ddlMonth.SelectedValue));
                Panel1.Visible = true;
                //Label5.Visible = false;

                //  Label5.Text = totalDays.ToString();
                Label4.Text = attendedDays.ToString();
                //   Label3.Text = ee.Position;
                Label2.Text = ee.Department;
                Label1.Text = ee.EmpId.ToString();
            }
        }
Пример #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Auths a = new Auths();

            if (TextBox1.Text == string.Empty || TextBox2.Text == string.Empty)
            {
                TextBox1.Text  = "";
                TextBox2.Text  = "";
                Label1.Visible = true;
                Response.Redirect(Request.Url.AbsoluteUri);
            }
            string uname = a.getAuthen(TextBox1.Text, TextBox2.Text);

            if (uname != null && uname != string.Empty)
            {
                Session["username"] = uname;

                bool stat = a.getIsAdmin(TextBox1.Text, TextBox2.Text);
                if (stat)
                {
                    Session["admin"] = "true";
                }
                else
                {
                    Session["admin"] = "false";
                }
                Response.Redirect("ViewEmployee.aspx");
            }
            else
            {
                TextBox1.Text  = "";
                TextBox2.Text  = "";
                Label1.Visible = true;
            }
        }
Пример #4
0
        public void SendEmail(string body)
        {
            // Console.WriteLine("Mail To");
            string      userName = System.Configuration.ConfigurationManager.AppSettings["adminEmailId"];
            MailAddress to       = new MailAddress(userName);

            try
            {
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

                mail.From = new MailAddress("*****@*****.**");
                mail.To.Add(userName);
                mail.Subject = "Leave Notification";
                mail.Body    = "Leave Applied";

                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("employeemanager2014", "polly@123");
                SmtpServer.EnableSsl   = true;

                SmtpServer.Send(mail);
            }
            catch (Exception ex)
            {
                Auths aa = new Auths();
                aa.insertEmail(" " + body + " " + ex.Message);
            }
        }
Пример #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Auths auths = db.Auths.Find(id);

            db.Auths.Remove(auths);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #6
0
        public decimal calcuSalary(int Eid, int month)
        {
            Auths   aa           = new Auths();
            int     daysAttended = aa.getNoofDaysAttendedMonth(Eid, month);
            decimal i            = getSalaryPerHour(Eid);
            //  int j = getSalaryForDays(Eid, month);
            decimal TotalSal = i * 8 * daysAttended;

            return(TotalSal);
        }
Пример #7
0
 public ActionResult Edit([Bind(Include = "ID,ID_user,ID_pc,Auth_key,Device")] Auths auths)
 {
     if (ModelState.IsValid)
     {
         db.Entry(auths).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(auths));
 }
Пример #8
0
        public ActionResult Create([Bind(Include = "ID,ID_user,ID_pc,Auth_key,Device")] Auths auths)
        {
            if (ModelState.IsValid)
            {
                db.Auths.Add(auths);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(auths));
        }
Пример #9
0
        // GET: Auths/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Auths auths = db.Auths.Find(id);

            if (auths == null)
            {
                return(HttpNotFound());
            }
            return(View(auths));
        }
Пример #10
0
        public void getClick(int id)
        {
            EmpBL.EmpBusiness eb = new EmpBL.EmpBusiness();
            Auths             a  = new Auths();
            Employee          eq = eb.getEmpOnId(id);

            if (eq.EmpId == 0)
            {
                Label17.Text = "Employee not found";

                Label17.Visible = true;
            }
            else
            {
                Label2.Text = eq.EmpId.ToString();
                Label3.Text = eq.FirstName;
                Label4.Text = eq.MiddleName;
                Label5.Text = eq.LastName;
                Label6.Text = eq.Addreee;
                Label7.Text = eq.City;
                Label8.Text = eq.State;
                string[] zip = eq.ZipCode.Split('-');
                Label9.Text = zip[0].ToString() + '-' + zip[1].ToString();
                //Label8.Text =
                Label10.Text = eq.PhoneNumber;
                Label11.Text = eq.EmailId;
                Label12.Text = eq.Department;
                //     Label13.Text = Convert.ToString(eq.Salary);
                //Label14.Text = eq.Leaves.ToString();
                //Label15.Text = eq.Position;

                Label14.Text = Convert.ToString(eq.Salary);
                Label15.Text = eq.Leaves.ToString();
                Label16.Text = eq.Position;
                if (eq.Picture != string.Empty)
                {
                    Image1.ImageUrl = "images/" + eq.Picture;
                }

                if (Session["admin"] == "true")
                {
                    //   setlabels();
                    Panel1.Visible = true;
                    Panel2.Visible = true;
                }
                //else
                //    Panel2.Visible = true;
            }
        }
Пример #11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Auths aa = new Auths();
            int   j  = aa.changePassword(Convert.ToInt32(Session["username"]), TextBox1.Text, TextBox2.Text);

            if (j == 2)
            {
                Label1.Visible = true;
            }
            else
            {
                Label1.Text    = "Failed to change";
                Label1.Visible = true;
            }
            TextBox1.Text = "";
            TextBox2.Text = "";
        }
Пример #12
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            EmpBusiness eb = new EmpBusiness();
            //   int   EmpId = Convert.ToInt32(Session["username"]);
            //=eb.getEmpOnId(EmpId);
            Auths a = new Auths();

            EmpEntity.Employee ee = a.getEmpOName(TextBox2.Text);
            if (ee.EmpId == 0)
            {
                Label5.Visible = true;
            }
            else
            {
                int month = Convert.ToInt32(ddlMonth.SelectedValue);
                Label4.Text = Convert.ToString(eb.calcuSalary(ee.EmpId, month));
                //Label3.Text = ee.Position;
                Label2.Text    = ee.Department;
                Label1.Text    = ee.EmpId.ToString();
                Panel1.Visible = true;
            }
        }