コード例 #1
0
        public ActionResult ShowNewMessage()
        {
            try
            {
                var TeacherList             = Connection.SMGTgetAllTeachers(_session.School_Id, "%", "Y").ToList(); // Order by teacher category
                List <TeacherModel> tcmlist = TeacherList.Select(x => new TeacherModel
                {
                    TeacherCategoryId = x.TeacherCategoryId,
                    UserId            = x.UserId,
                    Name      = x.Name,
                    TeacherId = x.TeacherId
                }).ToList();
                ViewBag.TeacherDropdown = new SelectList(tcmlist, "UserId", "Name");

                List <tblMessageType> MsgTypeList = Connection.tblMessageTypes.ToList();
                ViewBag.MessageTypesDropdown = new SelectList(MsgTypeList,
                                                              "MessageTypeId",
                                                              "MessageTypeDescription");

                var MsgId = Connection.tblParameters.Where(x => x.ParameterId == "PSMHS").Select(
                    x => x.ParameterValue).SingleOrDefault();
                long a = Convert.ToInt64(MsgId) + 1;

                tblParameter TCtable = Connection.tblParameters.SingleOrDefault(x => x.ParameterId == "PSMHS");
                TCtable.ParameterValue = a.ToString();
                Connection.SaveChanges();

                ViewBag.Message_Id = a.ToString();
            }
            catch (Exception Ex)
            {
                Errorlog.ErrorManager.LogError("ShowNewMessage() @PSMessageController", Ex);
            }
            return(PartialView("NewMessage"));
        }
コード例 #2
0
        public ActionResult NewMessage()
        {
            var             SchoolGrade     = Connection.SMGTgetSchoolGrade(_session.School_Id).ToList();//Need to Pass a Session Schoolid
            List <tblGrade> SchoolGradeList = SchoolGrade.Select(x => new tblGrade
            {
                GradeId   = x.GradeId,
                GradeName = x.GradeName,
                IsActive  = x.IsActive
            }).ToList();

            ViewBag.SchoolGrades = new SelectList(SchoolGradeList, "GradeId", "GradeName");
            List <SMGT_getSchoolExactivity_Result> ex = Connection.SMGT_getSchoolExactivity(
                _session.School_Id).ToList();                                       //Need to Pass a Session Schoolid

            ViewBag.SchoolExactivity = new SelectList(ex, "ActivityCode", "ActivityName");

            List <tblMessageType> MsgTypeList = Connection.tblMessageTypes.ToList();

            ViewBag.MessageTypesDropdown = new SelectList(MsgTypeList,
                                                          "MessageTypeId",
                                                          "MessageTypeDescription");

            var MsgId = Connection.tblParameters.Where(x => x.ParameterId == "PSMHS").Select(
                x => x.ParameterValue).SingleOrDefault();
            long a = Convert.ToInt64(MsgId) + 1;

            tblParameter TCtable = Connection.tblParameters.SingleOrDefault(x => x.ParameterId == "PSMHS");

            TCtable.ParameterValue = a.ToString();
            Connection.SaveChanges();

            ViewBag.Message_Id = a.ToString();

            return(View());
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblParameter tblparameter = db.tblParameters.Find(id);

            db.tblParameters.Remove(tblparameter);
            db.SaveChanges();
            DisplaySuccessMessage("Has delete a tblParameter record");
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        // GET: Parameter/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblParameter tblparameter = db.tblParameters.Find(id);

            if (tblparameter == null)
            {
                return(HttpNotFound());
            }
            return(View(tblparameter));
        }
コード例 #5
0
        public ActionResult Edit([Bind(Include = "ParameterID,ParameterName,ParameterOrder,Mainformula")] tblParameter tblparameter)
        {
            int c_id = Convert.ToInt32(Session["CompanyID"]);

            if (ModelState.IsValid)
            {
                tblparameter.CompanyID       = c_id;
                db.Entry(tblparameter).State = EntityState.Modified;
                db.SaveChanges();
                DisplaySuccessMessage("Has update a tblParameter record");
                return(RedirectToAction("Index"));
            }
            DisplayErrorMessage();
            return(View(tblparameter));
        }
コード例 #6
0
        public JsonResult AttachmentUpload(PtoSMessageHeaderModel Model)
        {
            try
            {
                var  file         = Model.Attachment_File;
                long AttachmentId = 0;
                tblParentToSchollMessageAttachment Attachmentfile = new tblParentToSchollMessageAttachment();
                if (file != null)
                {
                    var Atid = Connection.tblParameters.Where(x => x.ParameterId == "PSMAS").Select(
                        x => x.ParameterValue).SingleOrDefault();
                    AttachmentId = Convert.ToInt64(Atid);
                    long Next             = AttachmentId + 1;
                    var  Attachement_Path = "/Attachments/PtS/" + DateTime.Now.ToString("yyyy") + "/" +
                                            DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/" + Model.MessageId;
                    var fileName  = Path.GetFileName(file.FileName);
                    var extention = Path.GetExtension(file.FileName);
                    Attachmentfile.AttachementName = file.FileName;
                    Attachmentfile.AttachementPath = Attachement_Path + "/" + file.FileName;
                    Attachmentfile.MessageId       = Model.MessageId;
                    Attachmentfile.SeqNo           = AttachmentId;

                    Connection.tblParentToSchollMessageAttachments.Add(Attachmentfile);
                    Connection.SaveChanges();

                    tblParameter TCtable = Connection.tblParameters.SingleOrDefault(
                        x => x.ParameterId == "PSMAS");
                    TCtable.ParameterValue = Next.ToString();
                    Connection.SaveChanges();
                    if (!Directory.Exists(Server.MapPath(Attachement_Path)))
                    {
                        Directory.CreateDirectory(Server.MapPath(Attachement_Path));
                    }
                    file.SaveAs(Server.MapPath(Attachement_Path + "/" + file.FileName));
                }
                var result = new { FileName = file.FileName, SeqNo = AttachmentId };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception Ex)
            {
                Errorlog.ErrorManager.LogError("AttachmentUpload(PtoSMessageHeaderModel Model) @PSMessageController", Ex);
                var result = new { FileName = "Error", SeqNo = "Error" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }