private void SubmitRequest(string code, string sentto, string email) { var signerQuery = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).ToList(); foreach (var item in signerQuery) { tblRequest tblData = item as tblRequest; if (tblData.Is_Submitted == true && tblData.Is_Checked == false && tblData.Is_Assessed == false && tblData.Is_Approved == false && tblData.Is_Noted == false) { SendEmailToChecker(sentto.Trim(), code.Trim(), email.Trim()); } else if (tblData.Is_Submitted == true && tblData.Is_Checked == true && tblData.Is_Assessed == true && tblData.Is_Approved == false && tblData.Is_Noted == false) { SendEmailToNoter(sentto.Trim(), code.Trim(), email.Trim()); } } }
private void RejectExecute() { try { MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Question; MessageBoxResult resultMessageBox = MessageBox.Show("Are you sure you want to reject friend request?", "Accept approval", btnMessageBox, icnMessageBox); if (resultMessageBox == MessageBoxResult.Yes) { int userSending = UserRequest.UserID_Sending; int userToFindID = (from r in context.tblUsers where r.Username == Username select r.UserID).FirstOrDefault(); tblRequest requestToFind = (from r in context.tblRequests where r.UserID_Receiving == userToFindID && r.UserID_Sending == userSending select r).FirstOrDefault(); context.tblRequests.Remove(requestToFind); context.SaveChanges(); MessageBox.Show("Friend request is rejected!"); UserRequestList = tool.GetRequests(Username); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
PgNotification Map(tblRequest request) { PgNotification note = new PgNotification(); if((PgMessageType)request.MessageType==PgMessageType.SMSCN) { note = new SmscNotification(); } if ((PgMessageType)request.MessageType == PgMessageType.SMSCP) { note = new SmscPaymentConfirmation(); } note.Amount = request.Amount; note.ApplicationId = request.ApplicationId; note.MessageType = (PgMessageType) request.MessageType; note.Payee = request.Payee; note.ReferenceNumber = request.ReferenceId; if(note.MessageType==PgMessageType.SMSCN) { var smscn = note as SmscNotification; smscn.OutletPhoneNumber = request.Smsc_PhoneNumber; smscn.TillNumber = request.Smsc_TillNumber; } return note; }
public ActionResult DeleteConfirmed(int id) { tblRequest tblRequest = db.tblRequests.Find(id); db.tblRequests.Remove(tblRequest); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IDRequest,DateRequest,DateNeeded,RequestedBy,Request,Budget,ApprovedBy,IDRequestStatus,ApproverNotes,DateApproved,RequestorEmail,DateAcc,RequestorNotes")] tblRequest tblRequest) { if (ModelState.IsValid) { db.Entry(tblRequest).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblRequest)); }
public ActionResult Create([Bind(Include = "IDRequest,DateRequest,DateNeeded,RequestedBy,Request,Budget,ApprovedBy,IDRequestStatus,ApproverNotes,DateApproved,RequestorEmail,DateAcc,RequestorNotes")] tblRequest tblRequest) { if (ModelState.IsValid) { db.tblRequests.Add(tblRequest); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblRequest)); }
public ActionResult EmployeeResignations(RequestVM view) { var empid = Session["EmployeeId"].ToString(); var cc = Convert.ToInt32(Session["CompanyCode"].ToString()); var cci = Convert.ToInt32(Session["CityCode"].ToString()); var di = Convert.ToInt32(Session["DepartmentId"].ToString()); var pos = Session["Position"].ToString(); var ename = Session["Employeename"].ToString(); var req = db.tblRequestdetails.SqlQuery("select * from tblRequestdetail where EmployeeId=" + Convert.ToInt32(empid) + "").FirstOrDefault(); if (req == null) { var reqdetail = new tblRequestdetail() { CompanyCode = cc, CityCode = cci, DepartmentId = di, Position = pos, EmployeeId = Convert.ToInt32(empid), EmployeeName = ename, ReasonofRequest = view.ReasonofRequests, LastWorkingDate = view.LastWorkingDate, }; db.tblRequestdetails.Add(reqdetail); db.SaveChanges(); if (reqdetail != null) { var request = new tblRequest() { RequestId = reqdetail.RequestId, EmployeeId = Convert.ToInt32(empid), RequestType = "Resignation", DateofRequest = DateTime.Now, Status = "Pending", }; db.tblRequests.Add(request); db.SaveChanges(); if (request != null) { TempData["SuccessMessage"] = "Resignation Submitted"; return(RedirectToAction("SubmittedRequests", "Requests")); } } } else { TempData["ErrorMessage1"] = "You already Submitted Resignation"; } return(View()); }
// GET: Requests/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblRequest tblRequest = db.tblRequests.Find(id); if (tblRequest == null) { return(HttpNotFound()); } return(View(tblRequest)); }
private void SendRequestExecute() { try { int idReceiving = User.UserID; tblUser userSending = (from r in context.tblUsers where r.Username == Username select r).FirstOrDefault(); if (tool.AreTheyFriends(idReceiving, userSending.UserID) == true) { MessageBox.Show("You are already friends"); } else { MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Question; MessageBoxResult resultMessageBox = MessageBox.Show("Are you sure you want to send friend request?", "Request approval", btnMessageBox, icnMessageBox); if (resultMessageBox == MessageBoxResult.Yes) { if (tool.AreTheyFriends(userSending.UserID, idReceiving) == false && tool.StatusPending(userSending.UserID, idReceiving) == false) { tblRequest newRequest = new tblRequest(); newRequest.UserID_Receiving = idReceiving; newRequest.UserID_Sending = userSending.UserID; newRequest.Approved = false; context.tblRequests.Add(newRequest); context.SaveChanges(); MessageBox.Show("Friend request is sent."); } else if (tool.StatusPending(userSending.UserID, idReceiving) == true) { MessageBox.Show("Request is already sent."); } else { MessageBox.Show("You are already friend with this user."); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public tblRequest Addreqtfordgm(int Employeeid, int posid, string citytrans, string ReasonofReq) { var addreq = new tblRequest() { EmployeeId = Employeeid, PositionId = posid, CitytoTranser = citytrans, RequestType = "Transfer", DateofRequest = DateTime.Now, Status = "Pending", ReasonofRequest = ReasonofReq, AuthorizedRole = "CEO", IsSeen = false, }; return(addreq); }
public int Save(PgNotification entity) { tblRequest toSave = new tblRequest(); toSave.Amount = entity.Amount; toSave.ApplicationId = entity.ApplicationId; toSave.DateCreated = DateTime.Now; toSave.Payee = entity.Payee; toSave.ReferenceId = entity.ReferenceNumber.ToString(); if (entity is SmscNotification) { SmscNotification smcs = entity as SmscNotification; toSave.Smsc_PhoneNumber = smcs.OutletPhoneNumber; toSave.Smsc_TillNumber = smcs.TillNumber; toSave.MessageType = (int)entity.MessageType; } if (entity is SmscPaymentConfirmation) { SmscPaymentConfirmation smcs = entity as SmscPaymentConfirmation; toSave.Smsc_PhoneNumber = smcs.OutletPhoneNumber; toSave.Smsc_TillNumber = smcs.TillNumber; toSave.MessageType = (int)entity.MessageType; } if (entity is Eazy247Notification) { Eazy247Notification smcs = entity as Eazy247Notification; toSave.Smsc_PhoneNumber = smcs.OutletPhoneNumber; toSave.Smsc_TillNumber = smcs.BillerNumber; toSave.MessageType = (int)entity.MessageType; } if (entity is Easy247Payment) { Easy247Payment smcs = entity as Easy247Payment; toSave.Smsc_PhoneNumber = smcs.OutletPhoneNumber; toSave.Smsc_TillNumber = smcs.BillerNumber; toSave.MessageType = (int)entity.MessageType; } _ctx.tblRequest.Add(toSave); _ctx.SaveChanges(); return toSave.Id; }
public tblRequest AddReqlforhr(int empid, int posid, DateTime FromDate, DateTime ToDate, string ReasonofReq, string leavetype) { var addreq = new tblRequest() { EmployeeId = empid, PositionId = posid, RequestType = "Leave", DateofRequest = DateTime.Now, FromDate = FromDate, ToDate = ToDate, Status = "Pending", ReasonofRequest = ReasonofReq, LeaveType = leavetype, AuthorizedRole = "CEO", IsSeen = false, }; return(addreq); }
protected void lnkviewdetails_Click(object sender, EventArgs e) { LinkButton lnkviewdetails = (LinkButton)sender; jrcode = lnkviewdetails.CommandArgument.ToString().Trim(); var verifyRequest = dbContext.tblRequests.Where(x => x.JR_Code == jrcode); foreach (var item in verifyRequest) { tblRequest tblData = item as tblRequest; //ForChecking if ((Convert.ToBoolean(tblData.IsRejected) == false && Convert.ToBoolean(tblData.IsCancelled) == false) && Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == false && Convert.ToBoolean(tblData.Is_Assessed) == false && Convert.ToBoolean(tblData.Is_Noted) == false && Convert.ToBoolean(tblData.Is_Approved) == false && Convert.ToBoolean(tblData.Is_JobAccepted) == false && Convert.ToBoolean(tblData.IsCompleted) == false ) { Response.Redirect("UserForChecking.aspx?RCode=" + jrcode); } //ForAssessment else if (Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == true && Convert.ToBoolean(tblData.Is_Assessed) == false && Convert.ToBoolean(tblData.Is_Noted) == false && Convert.ToBoolean(tblData.Is_Approved) == false && Convert.ToBoolean(tblData.Is_JobAccepted) == false && Convert.ToBoolean(tblData.IsCompleted) == false && (Convert.ToBoolean(tblData.IsRejected) == false && Convert.ToBoolean(tblData.IsCancelled) == false)) { Response.Redirect("UserForAssessment.aspx?RCode=" + jrcode); } //ForNoting else if (Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == true && Convert.ToBoolean(tblData.Is_Assessed) == true && Convert.ToBoolean(tblData.Is_Noted) == false && Convert.ToBoolean(tblData.Is_Approved) == false && Convert.ToBoolean(tblData.Is_JobAccepted) == false && Convert.ToBoolean(tblData.IsCompleted) == false && (Convert.ToBoolean(tblData.IsRejected) == false && Convert.ToBoolean(tblData.IsCancelled) == false)) { Response.Redirect("UserForNoting.aspx?RCode=" + jrcode); } //ForApproval else if (Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == true && Convert.ToBoolean(tblData.Is_Assessed) == true && Convert.ToBoolean(tblData.Is_Noted) == true && Convert.ToBoolean(tblData.Is_Approved) == false && Convert.ToBoolean(tblData.Is_JobAccepted) == false && Convert.ToBoolean(tblData.IsCompleted) == false && (Convert.ToBoolean(tblData.IsRejected) == false && Convert.ToBoolean(tblData.IsCancelled) == false)) { Response.Redirect("UserForApproval.aspx?RCode=" + jrcode); } //ViewDetailsWithJONo else if (Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == true && Convert.ToBoolean(tblData.Is_Assessed) == true && Convert.ToBoolean(tblData.Is_Noted) == true && Convert.ToBoolean(tblData.Is_Approved) == true && (Convert.ToBoolean(tblData.Is_JobAccepted) == false || (Convert.ToBoolean(tblData.Is_JobAccepted) == true) && Convert.ToBoolean(tblData.IsCompleted) == false && (Convert.ToBoolean(tblData.IsRejected) == false && Convert.ToBoolean(tblData.IsCancelled) == false))) { Response.Redirect("UserJOGenerated.aspx?RCode=" + jrcode); } //ViewDenied else if ((Convert.ToBoolean(tblData.IsRejected) == true || Convert.ToBoolean(tblData.IsCancelled) == true)) { Response.Redirect("UserDeniedAndCancelled.aspx?RCode=" + jrcode); } //ViewCompleted else if (Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == true && Convert.ToBoolean(tblData.Is_Assessed) == true && Convert.ToBoolean(tblData.Is_Noted) == true && Convert.ToBoolean(tblData.Is_Approved) == true && Convert.ToBoolean(tblData.Is_JobAccepted) == true && Convert.ToBoolean(tblData.IsCompleted) == true && (Convert.ToBoolean(tblData.IsRejected) == false && Convert.ToBoolean(tblData.IsCancelled) == false)) { Response.Redirect("UserCompleted.aspx?RCode=" + jrcode); } else { } } }
private void SaveRequest() { double s1, s2, s3, s4, s5, s6; if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { if (double.TryParse(tbQuantity_Jigs.Text, out var outParse)) { s1 = Convert.ToDouble(tbQuantity_Jigs.Text.Trim()); } else { s1 = 0; } if (double.TryParse(qtyhrtxt.Text, out var outParse2)) { s2 = Convert.ToDouble(qtyhrtxt.Text.Trim()); } else { s2 = 0; } if (double.TryParse(mreqtxt.Text, out var outParse3)) { s3 = Convert.ToDouble(mreqtxt.Text.Trim()); } else { s3 = 0; } if (double.TryParse(mcaptxt.Text, out var outParse4)) { s4 = Convert.ToDouble(mcaptxt.Text.Trim()); } else { s4 = 0; } if (double.TryParse(tbNextForecast.Text, out var outPars5)) { s5 = Convert.ToDouble(tbNextForecast.Text.Trim()); } else { s5 = 0; } tblRequest tbl = new tblRequest() { EmpID = Session["EmpID"].ToString().Trim(), DeptCode = Session["DeptCode"].ToString().Trim(), SectCode = Session["SectCode"].ToString().Trim(), Request_Date = DateTime.Now.Date, Incharge_ID = rdoInCharge.SelectedValue.ToString().Trim(), Customer = cboCustomer.SelectedValue.ToString().Trim(), Partcode = tbPartCode.Text.Trim(), Partname = tbPartName.Text.Trim(), JigType = cboTypeOfJig.SelectedValue.ToString().Trim(), Quantity = s1, QtyProdPerHr = s2, Monthly_Req = s3, Machine_Capacity = s4, NextForeCast = s5, Problem_Desc = tbjustification.Text.Trim().Replace("\r\n", "<br/>").Replace(" ", " ").Replace("\t", " ").Replace("'", "^"), Is_Submitted = true, IsHold = false, Is_Checked = false, Is_Reviewed = false, Is_Assessed = false, Is_JobAccepted = false, Is_Approved = false, Is_Noted = false, Is_AttachmentApproved = false, IsCompleted = false, JR_Code = Session["RCode"].ToString().Trim(), IsCancelled = false, IsRejected = false, Req_Remarks = "SIGNED", Checker = appr_name.Trim(), AssessedBy = "N/A", Noter = "N/A", Manager = "N/A", FinalAcceptanceBy = "N/A", IsSentToApprover_First = false, IsSentToApprover_Second = false, IsSentToApprover_Third = false, CreationDateTime = DateTime.Now }; dbContext.tblRequests.Add(tbl); dbContext.SaveChanges(); } else { if (double.TryParse(tbItemQuantity.Text, out var outParse)) { s6 = Convert.ToDouble(tbItemQuantity.Text.Trim()); } else { s6 = 0; } tblRequest tbl = new tblRequest() { EmpID = Session["EmpID"].ToString().Trim(), DeptCode = Session["DeptCode"].ToString().Trim(), SectCode = Session["SectCode"].ToString().Trim(), Request_Date = DateTime.Now.Date, Incharge_ID = rdoInCharge.SelectedValue.ToString().Trim(), Partname = tbItemName.Text.Trim(), Quantity = s6, Problem_Desc = tbjustification.Text.Trim().Replace(" ", " ").Replace("\t", " ").Replace("'", "^").Replace("\r\n", "<br/>"), Is_Submitted = true, IsHold = false, Is_Checked = false, Is_Reviewed = false, Is_Assessed = false, Is_JobAccepted = false, Is_Approved = false, Is_AttachmentApproved = false, Is_Noted = false, IsCompleted = false, JR_Code = Session["RCode"].ToString().Trim(), IsCancelled = false, IsRejected = false, Req_Remarks = "SIGNED", Checker = appr_name.Trim(), AssessedBy = "N/A", Noter = "N/A", Manager = "N/A", FinalAcceptanceBy = "N/A", IsSentToApprover_First = false, IsSentToApprover_Second = false, IsSentToApprover_Third = false, CreationDateTime = DateTime.Now }; dbContext.tblRequests.Add(tbl); dbContext.SaveChanges(); } foreach (ButtonListItem item in rdoReqType.Items) { if (item.Selected) { tblRequestType_Selected tbl = new tblRequestType_Selected() { JR_Code = Session["RCode"].ToString(), RequestTypeCode = item.Value.ToString() }; dbContext.tblRequestType_Selected.Add(tbl); } } dbContext.SaveChanges(); UpdateAttachmentStatus(); }
// state that the method you intend to create is a POST public HttpResponseMessage ussd([FromBody] Models.ServerResponse ServerResponse) { // declare a complex type as input parameter HttpResponseMessage rs; string response; string eventType = string.Empty; if (ServerResponse.text == null) { ServerResponse.text = ""; } // loop through the server's text value to determine the next cause of action if (ServerResponse.text.Equals("", StringComparison.Ordinal)) { NewsManagementDBEntities entity = new NewsManagementDBEntities(); tblRequest tableRequest = new USSD_Application.tblRequest(); tableRequest.PhoneNumber = ServerResponse.phoneNumber; tableRequest.ServiceCode = ServerResponse.serviceCode; tableRequest.SessionID = ServerResponse.sessionId; tableRequest.RequestStartDateTime = DateTime.Now; entity.tblRequests.Add(tableRequest); entity.SaveChanges(); response = "CON Welcome to our service \n"; response += " What type of NEWS you want today \n"; response += " 1. Sport \n"; response += " 2. Music \n"; response += " 3. Movie \n"; } else { string[] request = ServerResponse.text.Split('*'); if (request.Count() == 1) { response = "CON Please Enter Date to filter \n"; } else if (request.Count() == 2) { eventType = GetEventType(request[0]); DateTime eventDate = DateTime.Parse(request[1]); NewsManagementDBEntities entity = new NewsManagementDBEntities(); List <tblEvent> events = entity.tblEvents.Where(x => x.EventType == eventType && x.CreatedDate == eventDate).ToList(); if (events != null && events.Count > 0) { string newsTitles = string.Empty; response = "CON Please Enter the CODE on the left \n"; foreach (tblEvent singleEvent in events) { response += singleEvent.ID + ". " + singleEvent.Title + " \n"; } } else { response = "END Invalid Code selected"; } } else if (request.Count() == 3) { eventType = GetEventType(request[0]); DateTime eventDate = DateTime.Parse(request[1]); int eventID = int.Parse(request[2]); NewsManagementDBEntities entity = new NewsManagementDBEntities(); tblEvent singleEvent = entity.tblEvents.Where(x => x.ID == eventID && x.EventType == eventType && x.CreatedDate == eventDate).FirstOrDefault(); if (singleEvent != null) { response = "END " + singleEvent.Description; tblRequest oldRequest = entity.tblRequests.Where(x => x.SessionID == ServerResponse.sessionId).FirstOrDefault(); tblRequest newRequest = new tblRequest(); newRequest.PhoneNumber = ServerResponse.phoneNumber; newRequest.ServiceCode = ServerResponse.serviceCode; newRequest.SessionID = ServerResponse.sessionId; newRequest.RequestStartDateTime = oldRequest.RequestStartDateTime; newRequest.RequestCompleteDateTime = DateTime.Now; entity.Entry(oldRequest).CurrentValues.SetValues(newRequest); entity.SaveChanges(); } else { response = "END Invalid Code selected"; } } else { response = "END Invalid Option"; } } rs = Request.CreateResponse(HttpStatusCode.Created, response); rs.Content = new StringContent(response, Encoding.UTF8, "text/plain"); return(rs); }
public void AddLeaveReq(tblRequest obj) { context.tblRequests.Add(obj); }
protected void Page_Load(object sender, EventArgs e) { btnShowReject.Attributes["href"] = "javascript:void(0);"; btnShowReject.Attributes["onclick"] = String.Format("return ShowRejectForm('{0}','{1}','{2}');" , Request.QueryString["EmpID"].ToString().Trim(), Request.QueryString["RCode"].ToString().Trim(), "Approver"); btnShowHold.Attributes["href"] = "javascript:void(0);"; btnShowHold.Attributes["onclick"] = String.Format("return ShowHoldForm('{0}','{1}','{2}');" , Request.QueryString["EmpID"].ToString().Trim(), Request.QueryString["RCode"].ToString().Trim(), "Approver"); DeleteUnusedCodes(); if (!IsPostBack) { rdoInCharge.DataSource = dbContext.tblIncharges.Where(x => x.Incharge_ID == "07" || x.Incharge_ID == "08").ToList(); rdoInCharge.DataBind(); rdoReqType.DataSource = dbContext.tblRequestTypes.ToList(); rdoReqType.DataBind(); } approverempid2 = Request.QueryString["EmpID"].ToString().Trim(); var getchecker = dbContext.tblUsers.Where(x => x.EmpID == approverempid2); foreach (var item in getchecker) { tblUser tblData = item as tblUser; approverempid = tblData.EmpID; approveremail = tblData.EmailAdd; } var dbuser = dbHRISContext.SKPI_GetAllEmployeesByEmpID(approverempid).ToList(); foreach (DataRow row in ConvertToDataTable(dbuser).Rows) { approverposition = row["Pos_Desc"].ToString(); Session["Position"] = row["Pos_Desc"].ToString(); approverdeptcode = row["Dept_Code"].ToString(); approverdeptname = row["Dept_Desc"].ToString(); approversectcode = row["Sect_Code"].ToString(); approversectname = row["Sect_Desc"].ToString(); Session["FName"] = row["FirstName"].ToString(); approverfullname_lnamefirst = row["FullName_LnameFirst"].ToString(); approverfullname_fnamefirst = row["FullName_FnameFirst"].ToString(); Session["FullName_LnameFirst"] = row["FullName_LnameFirst"].ToString(); Session["FullName_FnameFirst"] = row["FullName_FnameFirst"].ToString(); } Session["RCode"] = Request.QueryString["RCode"].ToString(); jrcode = Session["RCode"].ToString(); SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; //SQLDSGetAttachment2.ConnectionString = ClsConfig.JobRequestConnectionString; var verifyRequest = dbContext.tblRequests.Where(x => x.JR_Code == jrcode); foreach (var item in verifyRequest) { tblRequest tblData = item as tblRequest; if ((Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == true && Convert.ToBoolean(tblData.Is_Assessed) == true && Convert.ToBoolean(tblData.Is_Noted) == true && Convert.ToBoolean(tblData.Is_Approved) == true && Convert.ToBoolean(tblData.Is_JobAccepted) == false && Convert.ToBoolean(tblData.IsCompleted) == false && (Convert.ToBoolean(tblData.IsRejected) == false || Convert.ToBoolean(tblData.IsCancelled) == false) ) || (Convert.ToBoolean(tblData.Is_JobAccepted) == true || Convert.ToBoolean(tblData.IsCompleted) == true)) { divSuccess.Visible = true; divApplication.Visible = false; divRejected.Visible = false; divCancelled.Visible = false; } else if (Convert.ToBoolean(tblData.IsRejected) == true) { divSuccess.Visible = false; divApplication.Visible = false; divRejected.Visible = true; divCancelled.Visible = false; } else if (Convert.ToBoolean(tblData.IsCancelled) == true) { divSuccess.Visible = false; divApplication.Visible = false; divRejected.Visible = false; divCancelled.Visible = true; } else { divSuccess.Visible = false; divApplication.Visible = true; divRejected.Visible = false; divCancelled.Visible = false; GetRequestDetails(); } } }
//internal int SaveTutorSubjects(TutorSubjects objReq) //{ // tblTutorSubject objSubjectData = new tblTutorSubject(); // using (var db = new WizzDataContext()) // { // objSubjectData = db.tblTutorSubjects.Where(x => x.fkTutorId == Convert.ToInt64(objReq.tutorId)).FirstOrDefault(); // if (objSubjectData == null) // { // //objSubjectData = new TutorSubjects(); // //objSubjectData.isApproved = true; // //objSubjectData.isActive = true; // //objSubjectData.fkUserId = Convert.ToInt64(objReq.userId); // //objSubjectData.latitude = Convert.ToDecimal(objReq.latitude); // //objSubjectData.longitude = Convert.ToDecimal(objReq.longitude); // //objSubjectData.subjects = objReq.majors; // //objSubjectData.TimeStamp = Convert.ToDateTime(objReq.timeStamp).Ticks; // //objSubjectData.updatedDate = DateTime.UtcNow; // //objSubjectData.createdDate = DateTime.UtcNow; // //objSubjectData.passingYear = objReq.passingYear; // //objSubjectData.referralcode = objReq.referalCode == null ? "" : objReq.referalCode; // //// profileData.fkClassId = String.Join(",", objReq.classes); // //objSubjectData.fkCollegeId = Convert.ToInt32(objReq.collegeId); // //db.tblTutorProfiles.InsertOnSubmit(objSubjectData); // } // else // { // //objSubjectData.isApproved = true; // //objSubjectData.isActive = true; // //objSubjectData.fkUserId = Convert.ToInt64(objReq.userId); // //objSubjectData.latitude = Convert.ToDecimal(objReq.latitude); // //objSubjectData.longitude = Convert.ToDecimal(objReq.longitude); // //objSubjectData.subjects = objReq.majors; // //objSubjectData.TimeStamp = Convert.ToDateTime(objReq.timeStamp).Ticks; // //objSubjectData.updatedDate = DateTime.UtcNow; // //objSubjectData.createdDate = DateTime.UtcNow; // //// profileData.fkClassId = String.Join(",", objReq.classes); // //objSubjectData.fkCollegeId = Convert.ToInt32(objReq.collegeId); // } // db.SubmitChanges(); // return 1; // } //} //save matched tutos in db and send notifications void SendRequest(StudentRequestModel objReq,List<usp_GetTutorsResult> tutors,string requestId) { var studentId =Convert.ToInt64(objReq.userId); using(var db=new WizzDataContext()) { foreach (var tutor in tutors.ToList()) { var request = new tblRequest(); request.createdDate = DateTime.UtcNow; request.updatedDate = DateTime.UtcNow; request.isAccepted = false; request.isDeleted = false; request.fkStudentId = studentId; request.fkTutorId = tutor.fkUserId; request.uniqueRequestId = requestId; request.timeStamp = DateTime.UtcNow.Ticks; db.tblRequests.InsertOnSubmit(request); db.SubmitChanges(); //sendpush if(!string.IsNullOrEmpty(tutor.deviceToken)) { PushData push=new PushData() { registration_ids = tutor.deviceToken, message = PushMessages.newRequest, type = Convert.ToInt16(PushType.newRequest).ToString(), badge = Convert.ToString(tutor.badge) }; // push.data = CommonMethod.ObjectToJson(objPush); if (tutor.deviceType == Convert.ToInt16(DeviceType.ios))//ios { SendPush objIOS=new SendPush(); objIOS.ConnectToAPNS(push); } else if (tutor.deviceType == Convert.ToInt16(DeviceType.android))//android { Android objAndroid = new Android(); objAndroid.send(push); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rdoInCharge.DataSource = dbContext.tblIncharges.Where(x => x.Incharge_ID == "07" || x.Incharge_ID == "08").ToList(); rdoInCharge.DataBind(); rdoReqType.DataSource = dbContext.tblRequestTypes.ToList(); rdoReqType.DataBind(); ddlAssessment.DataSource = dbContext.tblAssessments.OrderBy(x => x.ID).ToList(); ddlAssessment.DataBind(); } approverempid2 = Request.QueryString["EmpID"].ToString().Trim(); var getchecker = dbContext.tblUsers.Where(x => x.EmpID == approverempid2); foreach (var item in getchecker) { tblUser tblData = item as tblUser; approverempid = tblData.EmpID; approveremail = tblData.EmailAdd; } var dbuser = dbHRISContext.SKPI_GetAllEmployeesByEmpID(approverempid).ToList(); foreach (DataRow row in ConvertToDataTable(dbuser).Rows) { approverposition = row["Pos_Desc"].ToString(); Session["Position"] = row["Pos_Desc"].ToString(); approverdeptcode = row["Dept_Code"].ToString(); approverdeptname = row["Dept_Desc"].ToString(); approversectcode = row["Sect_Code"].ToString(); approversectname = row["Sect_Desc"].ToString(); Session["FName"] = row["FirstName"].ToString(); approverfullname_lnamefirst = row["FullName_LnameFirst"].ToString(); approverfullname_fnamefirst = row["FullName_FnameFirst"].ToString(); Session["FullName_LnameFirst"] = row["FullName_LnameFirst"].ToString(); Session["FullName_FnameFirst"] = row["FullName_FnameFirst"].ToString(); } jrcode = Request.QueryString["RCode"].ToString();//lnkviewdetails.CommandArgument.ToString().Trim(); Session["RCode"] = jrcode; var verifyRequest = dbContext.tblRequests.Where(x => x.JR_Code == jrcode); foreach (var item in verifyRequest) { tblRequest tblData = item as tblRequest; if ((Convert.ToBoolean(tblData.Is_Submitted) == true && Convert.ToBoolean(tblData.Is_Checked) == true && Convert.ToBoolean(tblData.Is_Assessed) == true && Convert.ToBoolean(tblData.Is_Noted) == true && Convert.ToBoolean(tblData.Is_Approved) == true && Convert.ToBoolean(tblData.Is_JobAccepted) == false && Convert.ToBoolean(tblData.IsCompleted) == false && (Convert.ToBoolean(tblData.IsRejected) == false || Convert.ToBoolean(tblData.IsCancelled) == false) ) || (Convert.ToBoolean(tblData.Is_JobAccepted) == true || Convert.ToBoolean(tblData.IsCompleted) == true)) { divSuccess.Visible = true; divApplication.Visible = false; divRejected.Visible = false; divCancelled.Visible = false; divApplication.Visible = false; } else if (Convert.ToBoolean(tblData.IsRejected) == true) { divSuccess.Visible = false; divApplication.Visible = false; divRejected.Visible = true; divCancelled.Visible = false; divApplication.Visible = false; } else if (Convert.ToBoolean(tblData.IsCancelled) == true) { divSuccess.Visible = false; divApplication.Visible = false; divRejected.Visible = false; divCancelled.Visible = true; divApplication.Visible = false; } else { if (!IsPostBack) { GetRequestDetails(); } string id = Request.QueryString["EmpID"].ToString().Trim(); //int dbCount = dbContext.tblInchargePersons.Where(x => x.EmpID == id && x.IsAssesstor == true && x.Incharge_ID == incharge).Count(); int dbCount = 0; if (incharge == "01" || incharge == "02" || incharge == "03") { //rdoInCharge.SelectedValue = "07"; dbCount = dbContext.tblInchargePersons.Where(x => x.EmpID == id && x.IsAssesstor == true && x.Incharge_ID == "07").Count(); } else if (incharge == "04" || incharge == "05" || incharge == "06") { //rdoInCharge.SelectedValue = "08"; dbCount = dbContext.tblInchargePersons.Where(x => x.EmpID == id && x.IsAssesstor == true && x.Incharge_ID == "08").Count(); } else { //rdoInCharge.SelectedValue = incharge; dbCount = dbContext.tblInchargePersons.Where(x => x.EmpID == id && x.IsAssesstor == true && x.Incharge_ID == incharge).Count(); } if (dbCount >= 1) { divApplication.Visible = true; divAssess.Visible = false; divSuccess.Visible = false; divRejected.Visible = false; divCancelled.Visible = false; } else { divApplication.Visible = false; divAssess.Visible = true; divSuccess.Visible = false; divRejected.Visible = false; divCancelled.Visible = false; } } } }
protected void ChangeIncharge(object sender, EventArgs e) { string link = string.Empty, body = string.Empty; dbContext = new JobRequestDBEntities(); var a = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); if (a != null) { tblRequest tbldata = a as tblRequest; tbldata.Incharge_ID = incharge; dbContext.Entry(tbldata).State = EntityState.Modified; dbContext.SaveChanges(); } link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/DirectAssessment.aspx"; var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsAssesstor == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { Boolean ress; ress = SaveEmailLogs(link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + jrcode , "Assesstor", dr["EmailAdd"].ToString().Trim(), approverfullname_fnamefirst.ToString().Trim() , dr["EmpID"].ToString().Trim(), Session["RCode"].ToString().Trim()); body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "I Have Prepared A Job Order Request For Your Assessment."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + jrcode; body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Requesting For Approval"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } dbContext.SaveChanges(); SendToRequestor_Transferred(); Show("Record Successfully Transferred"); divRecords.Visible = true; gridRecords.Rebind(); }