コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblNotification tblNotification = db.tblNotifications.Find(id);

            db.tblNotifications.Remove(tblNotification);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
    protected void btnAssignProject_Click(object sender, EventArgs e)
    {
        try
        {
            var DC = new DataClassesDataContext();
            foreach (RepeaterItem item in rptEmployeeList.Items)
            {
                RadioButton rd = (RadioButton)item.FindControl("rdEmployee");
                if (rd.Checked)
                {
                    EmpID = Convert.ToInt32(rd.Text);
                }
            }



            //Assign Project Manager
            bool acknow = ProjectObject.AssignProject(ProjectID, EmpID, Convert.ToInt32(Session["AdminID"]));
            //ProjectName
            tblProject ProjectName = (from ob in DC.tblProjects
                                      where ob.ProjectID == ProjectID
                                      select ob).Single();
            //Notification
            tblNotification Notification = new tblNotification();
            Notification.Title       = "Assign Project Manager";
            Notification.Description = "You are selected Project Manager for" + " " + ProjectName.Title;
            Notification.CreatedOn   = DateTime.Now;
            Notification.CreatedBy   = Convert.ToInt32(Session["AdminID"]);
            DC.tblNotifications.InsertOnSubmit(Notification);
            DC.SubmitChanges();
            tblNotification NID = (from obID in DC.tblNotifications
                                   orderby obID.NotificationID descending
                                   select obID).First();

            tblNotificationDetail Detail = new tblNotificationDetail();
            Detail.NotificationID = NID.NotificationID;
            Detail.PersonID       = EmpID;
            Detail.IsAdmin        = false;
            Detail.IsRead         = false;
            Detail.IsNotify       = false;
            DC.tblNotificationDetails.InsertOnSubmit(Detail);
            DC.SubmitChanges();



            Response.Redirect("ViewProject.aspx");
            //Response.Write(acknow);
        }
        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["AdminID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
コード例 #3
0
        public int AddNotification(string userid, int trainid, string emailid)
        {
            tblNotification notifi = new tblNotification();

            notifi.UserId      = userid;
            notifi.EmailId     = emailid;
            notifi.CreatedDate = DateTime.Now;
            notifi.Status      = "Y";
            notifi.TrainId     = trainid;
            return(repo.AddNotification(notifi));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "NotificationId,SenderId,ReceiverId,NotificationDate,NotificationBody,IsSeen")] tblNotification tblNotification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblNotification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ReceiverId = new SelectList(db.tblUsers, "UserId", "UserName", tblNotification.ReceiverId);
     ViewBag.SenderId   = new SelectList(db.tblUsers, "UserId", "UserName", tblNotification.SenderId);
     return(View(tblNotification));
 }
コード例 #5
0
        // GET: Notifications/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblNotification tblNotification = db.tblNotifications.Find(id);

            if (tblNotification == null)
            {
                return(HttpNotFound());
            }
            return(View(tblNotification));
        }
コード例 #6
0
        public JsonResult Save_Notification(tblNotification[] arr)
        {
            var value = false;
            var Id    = 0;

            try
            {
                if (arr[0].Id > 0)
                {
                    Id = arr[0].Id;
                    var update = db.tblNotifications.Find(arr[0].Id);
                    update.N_Content = arr[0].N_Content;
                    db.SaveChanges();
                    value = true;
                }
                else
                {
                    var notificationnew = new tblNotification();
                    var layid           = (from SLi in db.tblNotifications
                                           where SLi.Id > 0
                                           orderby SLi.Id descending
                                           select new
                    {
                        Id = SLi.Id
                    }).Take(1).ToArray();

                    if (layid.Any())
                    {
                        notificationnew.Id = layid[0].Id + 1;
                    }
                    else
                    {
                        notificationnew.Id = 1;
                    }
                    Id = notificationnew.Id;
                    notificationnew.N_Content = arr[0].N_Content;
                    notificationnew.N_Show    = 1;
                    db.tblNotifications.Add(notificationnew);
                    db.SaveChanges();
                    value = true;
                }
            }
            catch (Exception)
            {
                value = false;
            }
            var data = new { sussecc = value, Id = Id };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
        // GET: Notifications/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblNotification tblNotification = db.tblNotifications.Find(id);

            if (tblNotification == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ReceiverId = new SelectList(db.tblUsers, "UserId", "UserName", tblNotification.ReceiverId);
            ViewBag.SenderId   = new SelectList(db.tblUsers, "UserId", "UserName", tblNotification.SenderId);
            return(View(tblNotification));
        }
コード例 #8
0
        public ActionResult sendNotiIfRejected([Bind(Include = "NotificationId,SenderId,ReceiverId,NotificationDate,NotificationBody,IsSeen")] tblNotification tblNotification)
        {
            if (
                cookieSystemPositionReading().Value == 3 + "" || cookieSystemPositionReading().Value == 4 + "")
            {
                string ReqSlipFilePath  = "~/File/reqSlipId.txt";
                string currentReqSlipId = read(ReqSlipFilePath);
                //int reqSlipId = Int32.Parse(currentReqSlipId);
                int senderId = Int32.Parse(read("~/File/currentUserId.txt"));

                if (!string.IsNullOrEmpty(currentReqSlipId))
                {
                    tblRequisitionSlip rqpSlip = db.tblRequisitionSlips.Find(Int32.Parse(currentReqSlipId));

                    rqpSlip.NotificationId = tblNotification.NotificationId;

                    tblNotification.NotificationDate = DateTime.Now;



                    tblNotification.SenderId   = senderId;
                    tblNotification.ReceiverId = rqpSlip.ApplicantId;
                    tblNotification.IsSeen     = 0;
                    db.tblNotifications.Add(tblNotification);
                    db.SaveChanges();

                    Write(ReqSlipFilePath, "");
                }

                tblUser sender = db.tblUsers.Find(senderId);

                if (sender.SystemPosition == 3)
                {
                    return(RedirectToAction("seeUncheckedRequisitionSlip", "RequisitionSlips"));
                }

                else
                {
                    return(RedirectToAction("seeUncheckedRequisitionSlipDirector", "RequisitionSlips"));
                }
            }

            else
            {
                return(RedirectToAction("Login", "Users"));
            }
        }
コード例 #9
0
        public static void emergencySent()
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                tblNotification notification = new tblNotification
                {
                    NotificationMessage  = "An emergency has been received",
                    NotificationLink     = "Emergencies.aspx",
                    NotificationDateTime = DateTime.UtcNow,
                    NotificationType     = "E",
                    UserID = null,
                    IsSeen = false
                };

                db.tblNotifications.InsertOnSubmit(notification);

                //Check
                db.SubmitChanges();
            }
        }
コード例 #10
0
        public static void requestSent()
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                tblNotification notification = new tblNotification
                {
                    NotificationMessage  = "An account verification request has been received!",
                    NotificationLink     = "Requests.aspx",
                    NotificationDateTime = DateTime.UtcNow,
                    NotificationType     = "A",
                    UserID = null,
                    IsSeen = false
                };

                db.tblNotifications.InsertOnSubmit(notification);

                //Check
                db.SubmitChanges();
            }
        }
コード例 #11
0
        public static void feedbackSent()
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                tblNotification notification = new tblNotification
                {
                    NotificationMessage  = "New feedback has been received!",
                    NotificationLink     = "Feedback.aspx",
                    NotificationDateTime = DateTime.UtcNow,
                    NotificationType     = "F",
                    UserID = null,
                    IsSeen = false
                };

                db.tblNotifications.InsertOnSubmit(notification);

                //Check
                db.SubmitChanges();
            }
        }
コード例 #12
0
        public static void alertSent(string description)
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                List <tblUser> users = db.tblUsers.Where(x => x.UserTypeID != 1 && x.IsVerified == true && x.UserTypeID != 2).ToList();

                foreach (tblUser user in users)
                {
                    tblNotification notification = new tblNotification
                    {
                        NotificationDateTime = DateTime.UtcNow,
                        NotificationLink     = "#",
                        NotificationMessage  = description,
                        NotificationType     = "B"
                    };

                    db.tblNotifications.InsertOnSubmit(notification);
                    db.SubmitChanges();
                }
            }
        }
コード例 #13
0
        public IHttpActionResult PostSetWinner(string bID, string aID)
        {
            try
            {
                var data = db.tblAuctionItems.SingleOrDefault(a => a.AuctionId == aID);
                data.WinnerId = bID;

                tblNotification notif = new tblNotification();
                notif.biddersID       = bID;
                notif.auctionID       = aID;
                db.Entry(notif).State = EntityState.Added;


                db.SaveChanges();

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
コード例 #14
0
        public ActionResult SendNotification([Bind(Include = "NotificationId,SenderId,ReceiverId,NotificationDate,NotificationBody,IsSeen")] tblNotification tblNotification)
        {
            if (cookieSystemPositionReading().Value == 1 + "" || cookieSystemPositionReading().Value == 2 + "" ||
                cookieSystemPositionReading().Value == 3 + "" || cookieSystemPositionReading().Value == 4 + "")
            {
                if (ModelState.IsValid)
                {
                    string filePath      = "~/File/currentUserId.txt";
                    string currentUserId = read(filePath);
                    tblNotification.SenderId         = Int32.Parse(currentUserId);
                    tblNotification.NotificationDate = DateTime.Now;
                    tblNotification.IsSeen           = 0;
                    db.tblNotifications.Add(tblNotification);
                    db.SaveChanges();
                }

                return(RedirectToAction("GoToNotificationSystem", "System"));
            }

            else
            {
                return(RedirectToAction("Login", "Users"));
            }
        }
コード例 #15
0
 protected void rptNotify_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         var             DC       = new DataClassesDataContext();
         tblNotification NotiData = (from obj in DC.tblNotifications
                                     where obj.NotificationID == Convert.ToInt32(e.CommandArgument)
                                     select obj).Single();
         tblNotificationDetail NotiDetailData = (from obj in DC.tblNotificationDetails
                                                 where obj.NotificationID == NotiData.NotificationID && obj.PersonID == Convert.ToInt32(Session["EmpID"]) && (obj.IsAdmin == false || obj.IsAdmin == null)
                                                 select obj).Single();
         NotiDetailData.IsRead = true;
         DC.SubmitChanges();
         BindData();
     }
     catch (Exception ex)
     {
         int    session    = Convert.ToInt32(Session["EmpID"].ToString());
         string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
         string MACAddress = GetMacAddress();
         AddErrorLog(ref ex, PageName, "Employee", session, 0, MACAddress);
         //ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
     }
 }
コード例 #16
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            var       DC         = new DataClassesDataContext();
            tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
            tblTeam   TeamData   = DC.tblTeams.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
            int       cnt        = DC.tblTeamModules.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
            if (cnt > 0)
            {
                tblTeamModule TeamModuleNewData = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
                if (ddTeamLeader.SelectedValue != "")
                {
                    tblNotification NotificationCancel = new tblNotification();
                    NotificationCancel.Title       = "Team Leader Cancelling";
                    NotificationCancel.Description = "You are cancel Team Leader for" + " " + ModuleData.Title + " " + "work in" + " " + lblProName.Text;
                    NotificationCancel.CreatedOn   = DateTime.Now;
                    NotificationCancel.CreatedBy   = Convert.ToInt32(Session["EmpID"]);
                    DC.tblNotifications.InsertOnSubmit(NotificationCancel);
                    DC.SubmitChanges();
                    tblNotification NID = (from obID in DC.tblNotifications
                                           orderby obID.NotificationID descending
                                           select obID).First();
                    tblNotificationDetail DetailCancel = new tblNotificationDetail();
                    DetailCancel.NotificationID = NID.NotificationID;
                    DetailCancel.PersonID       = TeamModuleNewData.EmpID;
                    DetailCancel.IsAdmin        = false;
                    DetailCancel.IsRead         = false;
                    DetailCancel.IsNotify       = false;
                    DC.tblNotificationDetails.InsertOnSubmit(DetailCancel);
                    TeamModuleNewData.EmpID = Convert.ToInt32(ddTeamLeader.SelectedValue);
                    //Notification Cancellation
                }
                //Notification
                tblNotification Notification = new tblNotification();
                Notification.Title       = "Assign Team Leader";
                Notification.Description = "You are selected Team Leader for" + " " + ModuleData.Title + " " + "work in" + " " + lblProName.Text;
                Notification.CreatedOn   = DateTime.Now;
                Notification.CreatedBy   = Convert.ToInt32(Session["EmpID"]);
                DC.tblNotifications.InsertOnSubmit(Notification);
                DC.SubmitChanges();
                tblNotification NID2 = (from obID in DC.tblNotifications
                                        orderby obID.NotificationID descending
                                        select obID).First();
                tblNotificationDetail Detail = new tblNotificationDetail();
                Detail.NotificationID = NID2.NotificationID;
                Detail.PersonID       = TeamModuleNewData.EmpID;
                Detail.IsAdmin        = false;
                Detail.IsRead         = false;
                Detail.IsNotify       = false;
                DC.tblNotificationDetails.InsertOnSubmit(Detail);
            }
            else
            {
                if (ddTeamLeader.SelectedValue != "")
                {
                    tblTeamModule TeamModuleNewData = new tblTeamModule();
                    TeamModuleNewData.EmpID     = Convert.ToInt32(ddTeamLeader.SelectedValue);
                    TeamModuleNewData.TeamID    = TeamData.TeamID;
                    TeamModuleNewData.CreatedOn = DateTime.Now;
                    TeamModuleNewData.CreatedBy = Convert.ToInt32(Session["EmpID"]);
                    TeamModuleNewData.ModuleID  = Convert.ToInt32(ltrModuleID.Text);
                    DC.tblTeamModules.InsertOnSubmit(TeamModuleNewData);
                    DC.SubmitChanges();
                    //Notification
                    tblNotification Notification = new tblNotification();
                    Notification.Title       = "Assign Team Leader";
                    Notification.Description = "You are selected Team Leader for" + " " + ModuleData.Title + " " + "work in" + " " + lblProName.Text;
                    Notification.CreatedOn   = DateTime.Now;
                    Notification.CreatedBy   = Convert.ToInt32(Session["EmpID"]);
                    DC.tblNotifications.InsertOnSubmit(Notification);
                    DC.SubmitChanges();
                    tblNotification NID = (from obID in DC.tblNotifications
                                           orderby obID.NotificationID descending
                                           select obID).First();
                    tblNotificationDetail Detail = new tblNotificationDetail();
                    Detail.NotificationID = NID.NotificationID;
                    Detail.PersonID       = TeamModuleNewData.EmpID;
                    Detail.IsAdmin        = false;
                    Detail.IsRead         = false;
                    Detail.IsNotify       = false;
                    DC.tblNotificationDetails.InsertOnSubmit(Detail);
                }
            }
            ModuleData.Title       = txtModuleName.Text;
            ModuleData.Description = txtCkEditor.Text;
            tblProject ProjectData = DC.tblProjects.Single(ob => ob.ProjectID == ModuleData.ProjectID);
            if (txtDDate.Text != "")
            {
                if (Convert.ToDateTime(txtDDate.Text) < ProjectData.DeadlineDate && Convert.ToDateTime(txtDDate.Text) > ModuleData.AssignDate)
                {
                    if (txtDDate.Text == "")
                    {
                        if (lblDDate.Text != "Select Deadline Date")
                        {
                            ModuleData.DeadlineDate = Convert.ToDateTime(lblDDate.Text);
                        }
                    }
                    else
                    {
                        ModuleData.DeadlineDate = Convert.ToDateTime(txtDDate.Text);
                    }
                }
                else
                {
                    Session["errorDDate"] = true;
                }
            }
            if (ddPriority.SelectedValue != "")
            {
                ModuleData.Priority = Convert.ToInt32(ddPriority.SelectedValue);
            }
            if (ddRisk.SelectedValue != "")
            {
                ModuleData.Risk = Convert.ToInt32(ddRisk.SelectedValue);
            }
            if (ddState.SelectedIndex == 3)
            {
                int TaskPanding = DC.tblTasks.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text) && ob.State != 4);
                if (TaskPanding > 0)
                {
                    Session["errorClose"] = true;
                }
                else
                {
                    ModuleData.State = Convert.ToInt32(ddState.SelectedValue);
                }
            }
            else
            {
                ModuleData.State = Convert.ToInt32(ddState.SelectedValue);
            }

            if ((DC.tblTeamModules.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text))) > 0)
            {
                tblTeamModule MemberData      = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
                int           cntEmpAppraisal = DC.tblEmpAppraisals.Count(ob => ob.EmpID == MemberData.EmpID);

                if (MemberData.EmpID != null)
                {
                    if (cntEmpAppraisal > 0)
                    {
                        tblEmpAppraisal EmpAppraisalData = DC.tblEmpAppraisals.Single(ob => ob.EmpID == MemberData.EmpID);
                        EmpAppraisalData.Quality       = EmpAppraisalData.Quality + Convert.ToDecimal(rngQuality.Text);
                        EmpAppraisalData.Avialibility  = EmpAppraisalData.Avialibility + Convert.ToDecimal(rngAvialibility.Text);
                        EmpAppraisalData.Communication = EmpAppraisalData.Communication + Convert.ToDecimal(rngCommunication.Text);
                        EmpAppraisalData.Cooperation   = EmpAppraisalData.Cooperation + Convert.ToDecimal(rngCooperation.Text);
                    }
                    else
                    {
                        int cntAppraisal = DC.tblTeamModules.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
                        //Response.Redirect(cntAppraisal.ToString());
                        if (cntAppraisal > 0)
                        {
                            tblEmpAppraisal EmpAppraisalData = new tblEmpAppraisal();
                            EmpAppraisalData.EmpID         = MemberData.EmpID;
                            EmpAppraisalData.Quality       = Convert.ToDecimal(rngQuality.Text);
                            EmpAppraisalData.Avialibility  = Convert.ToDecimal(rngAvialibility.Text);
                            EmpAppraisalData.Communication = Convert.ToDecimal(rngCommunication.Text);
                            EmpAppraisalData.Cooperation   = Convert.ToDecimal(rngCooperation.Text);
                            EmpAppraisalData.Skills        = Convert.ToDecimal(0.0);
                            EmpAppraisalData.Deadlines     = Convert.ToDecimal(0.0);
                            EmpAppraisalData.CreatedOn     = DateTime.Now;
                            EmpAppraisalData.CreatedBy     = Convert.ToInt32(Session["EmpID"]);
                            DC.tblEmpAppraisals.InsertOnSubmit(EmpAppraisalData);
                        }
                    }
                }
            }

            DC.SubmitChanges();
            Response.Redirect("ModuleDetail.aspx");
        }
        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["EmpID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Employee", session, 0, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
コード例 #17
0
 public int AddNotification(tblNotification notification)
 {
     db.tblNotifications.Add(notification);
     return(db.SaveChanges());
 }
コード例 #18
0
    protected void btnsub_Click(object sender, EventArgs e)
    {
        try {
            panel1.Visible = true;
            var dc = new DataClassesDataContext();
            using (DataClassesDataContext data = new DataClassesDataContext())
            {
                tblAddress add = new tblAddress()
                {
                    Address   = txtadd.Text,
                    Area      = txtarea.Text,
                    Landmark  = txtlm.Text,
                    PincodeNo = txtpinno.Text,
                    CityID    = ddlcity.SelectedIndex
                };

                data.tblAddresses.InsertOnSubmit(add);
                data.SubmitChanges();

                string chk;
                if (radveg.Checked)
                {
                    chk = "veg";
                }
                else if (radnonveg.Checked)
                {
                    chk = "Non-Veg";
                }
                else
                {
                    chk = "Both";
                }


                var img = (from im in dc.tblImages
                           orderby im.ImagesID descending
                           select im).FirstOrDefault();

                tblServiceProvider user = new tblServiceProvider()
                {
                    AddressID   = add.AddressID,
                    Password    = Session["pass"].ToString(),
                    FirstName   = txtfnm.Text,
                    LastName    = txtlnm.Text,
                    Email       = txtmail.Text,
                    ImageID     = Convert.ToInt32(img.ImagesID),
                    Veg_NonVeg  = chk,
                    VerifyBy    = 1,
                    CreatedOn   = DateTime.Now,
                    ContactNo   = txtphno.Text,
                    CompanyName = txtcompnm.Text
                };
                data.tblServiceProviders.InsertOnSubmit(user);
                data.SubmitChanges();

                using (DataClassesDataContext des = new DataClassesDataContext())
                {
                    tblNotification str = new tblNotification();
                    str.Title       = "ServiceProvider Registered";
                    str.Description = "You have new ServiceProvider registered";
                    str.CreatedOn   = DateTime.Now;
                    str.CreatedBy   = Convert.ToInt32(Session["ServiceProviderID"]);
                    des.tblNotifications.InsertOnSubmit(str);
                    des.SubmitChanges();

                    tblNotificationDetail strr = new tblNotificationDetail();
                    strr.NotificationID = str.NotificationID;
                    strr.IsRead         = false;
                    strr.IsNotify       = false;
                    des.tblNotificationDetails.InsertOnSubmit(strr);
                    des.SubmitChanges();
                }
                Response.Redirect("Profile_SP.aspx");
            }
        }
        catch (Exception ex)
        {
            //int session = Convert.ToInt32(Session["UserID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "User", 0, 0, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
コード例 #19
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        var           DC             = new DataClassesDataContext();
        tblTask       TaskData       = DC.tblTasks.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text));
        tblModule     ModuleData     = DC.tblModules.Single(ob => ob.ModuleID == TaskData.ModuleID);
        tblTeamModule TeamModuleData = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(TaskData.ModuleID));
        int           cntTeamMember  = DC.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text));

        if (cntTeamMember > 0)
        {
            tblTeamMember NewTeamMember = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text));
            if (ddEmployee.SelectedValue != "")
            {
                NewTeamMember.EmpID = Convert.ToInt32(ddEmployee.SelectedValue);
                tblNotification NotificationCancel = new tblNotification();
                NotificationCancel.Title       = "Team Leader Cancelling";
                NotificationCancel.Description = "You are cancel Employee for" + " " + TaskData.Title + " " + "work in" + " " + lblProName.Text;
                NotificationCancel.CreatedOn   = DateTime.Now;
                NotificationCancel.CreatedBy   = Convert.ToInt32(Session["EmpID"]);
                DC.tblNotifications.InsertOnSubmit(NotificationCancel);

                tblNotificationDetail DetailCancel = new tblNotificationDetail();
                DetailCancel.NotificationID = DetailCancel.NotificationID;
                DetailCancel.PersonID       = TeamModuleData.EmpID;
                DetailCancel.IsAdmin        = false;
                DetailCancel.IsRead         = false;
                DetailCancel.IsNotify       = false;
                DC.tblNotificationDetails.InsertOnSubmit(DetailCancel);
            }
            tblNotification Notification = new tblNotification();
            Notification.Title       = "Assign Team Leader";
            Notification.Description = "You are selected Employee for" + " " + TaskData.Title + " " + "work in" + " " + lblProName.Text;
            Notification.CreatedOn   = DateTime.Now;
            Notification.CreatedBy   = Convert.ToInt32(Session["EmpID"]);
            DC.tblNotifications.InsertOnSubmit(Notification);

            tblNotificationDetail Detail = new tblNotificationDetail();
            Detail.NotificationID = Notification.NotificationID;
            Detail.PersonID       = TeamModuleData.EmpID;
            Detail.IsAdmin        = false;
            Detail.IsRead         = false;
            Detail.IsNotify       = false;
            DC.tblNotificationDetails.InsertOnSubmit(Detail);
        }
        else
        {
            tblTeamMember NewTeamMember = new tblTeamMember();
            if (ddEmployee.SelectedValue != "")
            {
                NewTeamMember.EmpID = Convert.ToInt32(ddEmployee.SelectedValue);
            }
            NewTeamMember.TaskID    = Convert.ToInt32(ltrTaskID.Text);
            NewTeamMember.TeamID    = Convert.ToInt32(TeamModuleData.TeamID);
            NewTeamMember.CreatedOn = DateTime.Now;
            NewTeamMember.CreatedBy = Convert.ToInt32(Session["EmpID"]);
            DC.tblTeamMembers.InsertOnSubmit(NewTeamMember);
            tblNotification Notification = new tblNotification();
            Notification.Title       = "Assign Team Leader";
            Notification.Description = "You are selected Employee for" + " " + TaskData.Title + " " + "work in" + " " + lblProName.Text;
            Notification.CreatedOn   = DateTime.Now;
            Notification.CreatedBy   = Convert.ToInt32(Session["EmpID"]);
            DC.tblNotifications.InsertOnSubmit(Notification);

            tblNotificationDetail Detail = new tblNotificationDetail();
            Detail.NotificationID = Notification.NotificationID;
            Detail.PersonID       = TeamModuleData.EmpID;
            Detail.IsAdmin        = false;
            Detail.IsRead         = false;
            Detail.IsNotify       = false;
            DC.tblNotificationDetails.InsertOnSubmit(Detail);
        }
        TaskData.Title       = txtTaskName.Text;
        TaskData.Description = txtCkEditor.Text;
        if (txtDDate.Text == "")
        {
            TaskData.DeadlineDate = Convert.ToDateTime(lblDDate.Text);
        }
        else
        {
            TaskData.DeadlineDate = Convert.ToDateTime(txtDDate.Text);
        }
        if (ddPriority.SelectedValue != "")
        {
            TaskData.Priority = Convert.ToInt32(ddPriority.SelectedValue);
        }
        if (ddRisk.SelectedValue != "")
        {
            TaskData.Risk = Convert.ToInt32(ddRisk.SelectedValue);
        }
        TaskData.State = Convert.ToInt32(ddState.SelectedValue);
        tblTeamMember MemberData      = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text));
        int           cntEmpAppraisal = DC.tblEmpAppraisals.Count(ob => ob.EmpID == MemberData.EmpID);

        if (cntEmpAppraisal > 0)
        {
            tblEmpAppraisal EmpAppraisalData = DC.tblEmpAppraisals.Single(ob => ob.EmpID == MemberData.EmpID);
            EmpAppraisalData.Quality       = EmpAppraisalData.Quality + Convert.ToDecimal(rngQuality.Text);
            EmpAppraisalData.Avialibility  = EmpAppraisalData.Avialibility + Convert.ToDecimal(rngAvialibility.Text);
            EmpAppraisalData.Communication = EmpAppraisalData.Communication + Convert.ToDecimal(rngCommunication.Text);
            EmpAppraisalData.Cooperation   = EmpAppraisalData.Cooperation + Convert.ToDecimal(rngCooperation.Text);
        }
        else
        {
            tblEmpAppraisal EmpAppraisalData = new tblEmpAppraisal();
            EmpAppraisalData.EmpID         = MemberData.EmpID;
            EmpAppraisalData.Quality       = Convert.ToDecimal(rngQuality.Text);
            EmpAppraisalData.Avialibility  = Convert.ToDecimal(rngAvialibility.Text);
            EmpAppraisalData.Communication = Convert.ToDecimal(rngCommunication.Text);
            EmpAppraisalData.Cooperation   = Convert.ToDecimal(rngCooperation.Text);
            EmpAppraisalData.CreatedOn     = DateTime.Now;
            EmpAppraisalData.CreatedBy     = Convert.ToInt32(Session["EmpID"]);
            DC.tblEmpAppraisals.InsertOnSubmit(EmpAppraisalData);
        }
        DC.SubmitChanges();
        Response.Redirect("TaskDetail.aspx");
    }
コード例 #20
0
    protected void btnAddSkill_Click(object sender, EventArgs e)
    {
        try
        {
            var DC = new DataClassesDataContext();
            //ProjectName
            tblProject ProjectName = (from ob in DC.tblProjects
                                      where ob.ProjectID == Convert.ToInt32(hdnProjectID.Value)
                                      select ob).Single();

            //NotificationCancel
            tblNotification NotificationCancel = new tblNotification();
            NotificationCancel.Title       = "Assign Project Manager";
            NotificationCancel.Description = "You are cancelled Project Manager for" + " " + ProjectName.Title;
            NotificationCancel.CreatedOn   = DateTime.Now;
            NotificationCancel.CreatedBy   = Convert.ToInt32(Session["AdminID"]);
            DC.tblNotifications.InsertOnSubmit(NotificationCancel);
            DC.SubmitChanges();
            tblNotification NIDCancel = (from obID in DC.tblNotifications
                                         orderby obID.NotificationID descending
                                         select obID).First();

            tblNotificationDetail DetailCancel = new tblNotificationDetail();
            DetailCancel.NotificationID = NIDCancel.NotificationID;
            DetailCancel.PersonID       = Convert.ToInt32(ProjectName.ManagerID);
            DetailCancel.IsAdmin        = false;
            DetailCancel.IsRead         = false;
            DetailCancel.IsNotify       = false;
            DC.tblNotificationDetails.InsertOnSubmit(DetailCancel);
            DC.SubmitChanges();


            //Change Project Manager
            ViewProjectObject.AssignProject(Convert.ToInt32(hdnProjectID.Value), Convert.ToInt32(ddProjetctManager.SelectedValue), Convert.ToInt32(Session["AdminID"]));

            //Notification
            tblNotification Notification = new tblNotification();
            Notification.Title       = "Project Manager Cancelling";
            Notification.Description = "You are selected Project Manager for" + " " + ProjectName.Title;
            Notification.CreatedOn   = DateTime.Now;
            Notification.CreatedBy   = Convert.ToInt32(Session["AdminID"]);
            DC.tblNotifications.InsertOnSubmit(Notification);
            DC.SubmitChanges();

            tblNotification NID = (from obID in DC.tblNotifications
                                   orderby obID.NotificationID descending
                                   select obID).First();

            tblNotificationDetail Detail = new tblNotificationDetail();
            Detail.NotificationID = NID.NotificationID;
            Detail.PersonID       = Convert.ToInt32(ddProjetctManager.SelectedValue);
            Detail.IsAdmin        = false;
            Detail.IsRead         = false;
            Detail.IsNotify       = false;
            DC.tblNotificationDetails.InsertOnSubmit(Detail);
            DC.SubmitChanges();
            Response.Redirect("ViewProject.aspx");
        }
        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["AdminID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
コード例 #21
0
    protected void btnsub_Click(object sender, EventArgs e)
    {
        try {
            panel1.Visible = true;
            var dc = new DataClassesDataContext();
            using (DataClassesDataContext data = new DataClassesDataContext())
            {
                tblAddress add = new tblAddress()
                {
                    Address   = txtadd.Text,
                    Area      = txtarea.Text,
                    Landmark  = txtlandmark.Text,
                    PincodeNo = txtpinno.Text,
                    CityID    = ddlcity.SelectedIndex
                };

                data.tblAddresses.InsertOnSubmit(add);
                data.SubmitChanges();



                var img = (from im in dc.tblImages
                           orderby im.ImagesID descending
                           select im).FirstOrDefault();
                tblClient user = new tblClient()
                {
                    AddressID = add.AddressID,
                    Password  = Session["pass"].ToString(),
                    FirstName = txtfnm.Text,
                    LastName  = txtlnm.Text,
                    Email     = txtmail.Text,
                    ImageID   = Convert.ToInt32(img.ImagesID),


                    CreatedOn = DateTime.Now,
                    ContactNo = txtphno.Text
                };
                data.tblClients.InsertOnSubmit(user);
                data.SubmitChanges();
                using (DataClassesDataContext des = new DataClassesDataContext())
                {
                    tblNotification str = new tblNotification();
                    str.Title       = "New Client Registered";
                    str.Description = txtfnm.Text + " " + txtlnm.Text + " is register on " + DateTime.Now + " with " + txtmail.Text + ".";
                    str.CreatedOn   = DateTime.Now;
                    str.CreatedBy   = Convert.ToInt32(Session["ClientID"]);
                    des.tblNotifications.InsertOnSubmit(str);
                    des.SubmitChanges();

                    tblNotificationDetail strr = new tblNotificationDetail();
                    strr.NotificationID = str.NotificationID;
                    strr.IsRead         = false;
                    strr.IsNotify       = false;
                    des.tblNotificationDetails.InsertOnSubmit(strr);
                    des.SubmitChanges();
                }
            }
            Response.Redirect("Default.aspx");
        }
        catch (Exception ex)
        {
            //int session = Convert.ToInt32(Session["ClientID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "User", 0, 0, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
コード例 #22
0
        public ActionResult AddPayments(ClientsPayment clientpayment)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //UpdateClientsPayment(clientpayment.Paid_Amount,clientpayment.Client);

                    using (ArchitectureEntitiesModel ObjEntities = new ArchitectureEntitiesModel())
                    {
                        var getclient = ObjEntities.ClientsViews.Where(e => e.Id == clientpayment.Client).FirstOrDefault();

                        //My Code Saad Bhatti
                        var chkData = ObjEntities.ClientsPayments.Where(c => c.Client == clientpayment.Client &&
                                                                        c.EntryDate.Year == clientpayment.Month.Year && c.EntryDate.Month == clientpayment.Month.Month).FirstOrDefault();
                        if (chkData != null)
                        {
                            if (Convert.ToInt32(getclient.Amount) >= Convert.ToInt32(clientpayment.Paid_Amount) + Convert.ToInt32(chkData.Paid_Amount))
                            {
                                if (long.Parse(clientpayment.Paid_Amount.ToString()) <= long.Parse(getclient.Amount.ToString()))
                                {
                                    int TotalAmount = Convert.ToInt32(getclient.Amount);
                                    int Due         = Convert.ToInt32(TotalAmount) - (Convert.ToInt32(clientpayment.Paid_Amount) + (Convert.ToInt32(chkData.Paid_Amount)));
                                    int Paid        = Convert.ToInt32(chkData.Paid_Amount) + Convert.ToInt32(clientpayment.Paid_Amount);
                                    chkData.Paid_Amount = Paid.ToString();
                                    chkData.Due_Amount  = Due.ToString();
                                    ObjEntities.SaveChanges();

                                    //clientpayment.EntryDate = DateTime.Now;

                                    //chkData.Due_Amount = Due.ToString();
                                    //ObjEntities.ClientsPayments.Add(clientpayment);
                                    //ObjEntities.SaveChanges();
                                    //int id1 = 0;
                                    //id1 = clientpayment.Id;
                                    //if (id1 > 0)
                                    //{

                                    // var getmonth = ObjEntities.tblMonth.Where(e => e.Id == clientpayment.Month).FirstOrDefault();
                                    TempData["Success"] = Session["UserName"] + " " + "Added" + " " + clientpayment.Paid_Amount + " " + "for" + " " + getclient.Name + " " + "for" + " " + "Month" + "-" + clientpayment.Month.Month;
                                    tblNotification tblnotification = new tblNotification();
                                    tblnotification.NotificationMessage = Session["UserName"] + " " + "Added" + " " + clientpayment.Paid_Amount + " " + "for" + " " + getclient.Name + " " + "for" + " " + "Month" + "-" + clientpayment.Month.Month;
                                    tblnotification.IsShow = 0;
                                    ObjEntities.tblNotifications.Add(tblnotification);
                                    ObjEntities.SaveChanges();
                                    //}
                                }
                                else
                                {
                                    TempData["Warning"] = "Paid Amount Should be less than due amount!";
                                }
                            }
                            else
                            {
                                TempData["Warning"] = "Paid Amount Should be less than due amount!";
                            }
                        }

                        else
                        {
                            int id = 0;
                            clientpayment.EntryDate  = Convert.ToDateTime(clientpayment.Month);
                            clientpayment.Due_Amount = Convert.ToString(long.Parse((getclient.Amount)) - long.Parse((clientpayment.Paid_Amount)));
                            ObjEntities.ClientsPayments.Add(clientpayment);
                            ObjEntities.SaveChanges();
                            id = clientpayment.Id;
                            if (id > 0)
                            {
                                // var getmonth = ObjEntities.tblMonth.Where(e => e.Id == clientpayment.Month).FirstOrDefault();
                                TempData["Success"] = Session["UserName"] + " " + "Added" + " " + clientpayment.Paid_Amount + "Payment" + " " + "for" + " " + getclient.Name + " " + "for" + " " + "Month" + "-" + clientpayment.Month;
                                tblNotification tblnotification = new tblNotification();
                                tblnotification.NotificationMessage = Session["UserName"] + " " + "Added" + " " + clientpayment.Paid_Amount + " " + "for" + " " + getclient.Name + " " + "for" + " " + "Month" + "-" + clientpayment.Month;
                                tblnotification.IsShow = 0;
                                ObjEntities.tblNotifications.Add(tblnotification);
                                ObjEntities.SaveChanges();
                            }
                        }
                    }
                }
                //var Clients = new SelectList(ObjEntities.ClientsView.ToList(), "Id", "Name");
                //ViewData["ClientPayment"] = Clients;
            }
            catch (Exception ex) { }

            return(RedirectToAction("AddPayments"));
        }