Beispiel #1
0
        public bool UpdateAcademicTeacher(ACD_Staff teacher)
        {
            string sql = " Update ACD_Staff set StaffName=@StaffName,StaffCode=@StaffCode,OrganizationId=@OrganizationId,TemporaryAddress=@TemporaryAddress,PermanentAddress=@PermanentAddress,Mobile=@Mobile," +
                         " Email=@Email,CitizenshipNo=@CitizenshipNo,JoinDate=@JoinDate,JoinDateBS=@JoinDateBS,DOB=@DOB,DOBBS=@DOBBS,Photo=@Photo,LastUpdatedBy=@LastUpdatedBy,LastUpdatedDate=@LastUpdatedDate" +
                         " where StaffId=@StaffId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, teacher);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Beispiel #2
0
        public ActionResult Create(FormCollection frm, HttpPostedFileBase file)
        {
            var ses     = sesrepo.GetSessionById((User as CustomPrincipal).UserId);
            int orgid   = ses.OrganizationId;
            var teacher = new ACD_Staff();

            teacher.StaffName        = frm["StaffName"];
            teacher.StaffCode        = frm["StaffCode"];
            teacher.OrganizationId   = orgid;// Convert.ToInt32(frm["OrganizationId"]);
            teacher.TemporaryAddress = frm["TemporaryAddress"];
            teacher.PermanentAddress = frm["PermanentAddress"];
            teacher.Mobile           = frm["Mobile"];
            teacher.Email            = frm["Email"];
            teacher.CitizenshipNo    = frm["CitizenshipNo"];
            //teacher.JoinDate = DateTime.ParseExact(frm["JoinDate"],"yyyy-MM-dd",null);
            teacher.JoinDateBS = frm["JoinDateBS"];
            //teacher.DOB = DateTime.ParseExact(frm["DOB"], "yyyy-MM-dd", null); ;
            teacher.DOBBS       = frm["DOBBS"];
            teacher.Photo       = frm["Photo"];
            teacher.EnteredBy   = (User as CustomPrincipal).UserId;
            teacher.EnteredDate = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.InsertAcademicTeacher(teacher);
                return(RedirectToAction("Index"));
            }
            ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name", teacher.OrganizationId);
            return(View(teacher));
        }
Beispiel #3
0
        public bool InsertAcademicTeacher(ACD_Staff Teacher)
        {
            string sql = " Insert into  ACD_Staff (StaffName,StaffCode,OrganizationId,TemporaryAddress,PermanentAddress,Mobile," +
                         "Email,CitizenshipNo,JoinDate,JoinDateBS,DOB,DOBBS,Photo,EnteredBy,EnteredDate,LastUpdatedBy,LastUpdatedDate,IsDeleted," +
                         "DeletedBy,DeletedDate) " +
                         " values " +
                         "(@StaffName,@StaffCode,@OrganizationId,@TemporaryAddress,@PermanentAddress,@Mobile," +
                         "@Email,@CitizenshipNo,@JoinDate,@JoinDateBS,@DOB,@DOBBS,@Photo,@EnteredBy,@EnteredDate,0,null,0," +
                         "0,null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, Teacher);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Beispiel #4
0
        // GET: AcademicTeacher/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null || id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ACD_Staff obj = db.GetAcademicTeacherById((int)id);

            if (obj == null)
            {
                return(HttpNotFound());
            }
            ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name", obj.OrganizationId);
            return(View(obj));
        }