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); } }
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); } }
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); } }
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); } }
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); } }
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"); }
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); } }