Пример #1
0
        public static object UpdateNews(tbl_News model, string NgayDeliverConvert)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true);
            var obj     = new GCRequest
            {
                _a = "Updatetbl_News", //Action prefix f,p for get data; tbl_PT_MailBox is table name
                _d = new Dictionary <string, object>
                {
                    { "NewsTypeId", model.NewsTypeId },
                    { "KieuString1", model.KieuString1 },
                    { "NgayDeliver", WebsiteExtension.ConvertDate(NgayDeliverConvert) },
                    { "Name", model.Name },
                    { "ShortContentNews", model.ShortContentNews },
                    { "hinhanhImageSample", model.hinhanhImageSample },
                    { "TagName", model.TagName },
                    { "UpdateDate", DateTime.Now },
                    { "UpdateStaffId", HttpContext.Current.Session["UserID"] },
                    { "ContentNews", model.ContentNews }
                },
                _c = new Dictionary <string, object>
                {
                    { "Id", model.Id },
                    { "Status", 1 }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            return(robj.Result);
        }
Пример #2
0
        public JsonResult ReSendActiveEmail(tbl_UserAuth md)
        {
            string sGuid = Guid.NewGuid().ToString();
            var    obj   = new GCRequest
            {
                _a = "Updatetbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id },
                    { "UserName", md.UserName },
                    { "Active", 0 },
                },
                _d = new Dictionary <string, object>
                {
                    { "TimeZone", sGuid },
                    { "CreatedDate", DateTime.Now },
                }
            };
            var robj = service.P(obj);

            if (int.Parse(robj.Records[0][0].ToString()) == 1)
            {
                string confirmCode    = Convert.ToBase64String(Encoding.Unicode.GetBytes(String.Format("user={0}&id={1}&code={2}&date={3}", md.UserName, md.Id, sGuid, DateTime.Now)));
                var    urlConfirmLink = "http://cotoiday.vn/RegisterAccount/ConfirmPage?token=" + confirmCode;
                var    resendResult   = SendConfirmMail.SendEmail(urlConfirmLink, md.Email);
                if (resendResult)
                {
                    return(Json(1));
                }
            }

            return(Json(0));
        }
Пример #3
0
        public static object PostNews(tbl_News model)
        {
            if (model.ContentNews != null)
            {
                model.ContentNews.Replace('\'', '\"');
            }
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true);
            var obj     = new GCRequest
            {
                _a = "Inserttbl_News", //Action prefix f,p for get data; tbl_PT_MailBox is table name
                _d = new Dictionary <string, object>
                {
                    { "NewsTypeId", model.NewsTypeId },
                    { "KieuString1", model.KieuString1 },
                    { "NgayDeliver", DateTime.Now },
                    { "Name", model.Name },
                    { "ShortContentNews", model.ShortContentNews },
                    { "hinhanhImageSample", model.hinhanhImageSample },
                    { "TagName", model.TagName },
                    { "ContentNews", model.ContentNews },
                    { "CreateDate", DateTime.Now },
                    { "CreateStaffId", HttpContext.Current.Session["UserID"] }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            return(robj.Result);
        }
Пример #4
0
        public JsonResult UpdateInforUser(tbl_UserAuth md)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj     = new GCRequest
            {
                _a = "Updatetbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id }
                },
                _d = new Dictionary <string, object>
                {
                    { "DisplayName", md.DisplayName },
                    { "BirthDate", md.BirthDate },
                    { "Nationality", md.Nationality },
                    { "Gender", md.Gender },
                    { "CityId", md.CityId },
                    { "Cmnd", md.Cmnd },
                    { "MaritalStatus", md.MaritalStatus },
                    { "Height", md.Height },
                    { "Weight", md.Weight },
                    { "Address", md.Address },
                    { "Email", md.Email },
                    { "PhoneNumber", md.PhoneNumber },
                    { "Criminal", md.Criminal },
                    { "CriminalReason", md.CriminalReason },
                    { "ModifiedDate", DateTime.Now }
                }
            };
            var robj = service.P(obj);

            return(Json(robj.Result));
        }
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            List <string> privilegeLevels = new List <string>();
            var           groupId         = HttpContext.Current.Session["GroupId"].ToString();
            var           service         = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var           obj             = new GCRequest
            {
                _a = "fGettbl_Admin_Group_Permission_View00", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "GroupId", groupId },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_Admin_Group_Permission_View00).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_Admin_Group_Permission_View00>();
                privilegeLevels = result.Select(c => c.PermissionIdCode.ToString()).ToList();
            }
            if (privilegeLevels.Contains(this.Role))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        public JsonResult UpdateProject(tbl_User_Project md)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj     = new GCRequest
            {
                _a = "Updatetbl_User_Project", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id }
                },
                _d = new Dictionary <string, object>
                {
                    { "JobId", md.JobId },
                    { "Name", md.Name },
                    { "Position", md.Position },
                    { "Partner", md.Partner },
                    { "FromDate", md.FromDate },
                    { "ToDate", md.ToDate },
                    { "Note", md.Note },
                    { "Image", md.Image },
                    { "UpdateDate", DateTime.Now }
                }
            };
            var robj = service.P(obj);

            return(Json(robj.Result));
        }
Пример #7
0
        public ActionResult _ProjectTabPartial(int id)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            // Get vi tri
            var obj = new GCRequest
            {
                _a = "fGettbl_Recruitment_Post", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", id },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_Recruitment_Post).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_Recruitment_Post>();
                result       = result.OrderByDescending(x => x.CreateDate).ToList();
                ViewBag.Post = result;
            }
            return(PartialView());
        }
Пример #8
0
        public ActionResult AccountNotActive(string searchfield)
        {
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            var obj = new GCRequest();

            var groupId = int.Parse(Session["GroupId"].ToString());

            if (groupId == 3)
            {
                obj = new GCRequest
                {
                    _a = "fGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                    _c = new Dictionary <string, object>
                    {
                        { "UserName", string.Format("(PATINDEX(N'%{0}%', $x) > 0 OR PATINDEX(N'%{0}%', Email) > 0 OR PATINDEX(N'%{0}%', PhoneNumber) > 0)", searchfield) },
                        { "TypeId", 2 },
                        { "Active", 0 },
                        { "StaffId", string.Format("$x > 0") }
                    },
                    _f = String.Join(",", typeof(tbl_UserAuth).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
                };
            }
            else
            {
                obj = new GCRequest
                {
                    _a = "fGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                    _c = new Dictionary <string, object>
                    {
                        { "UserName", string.Format("(PATINDEX(N'%{0}%', $x) > 0 OR PATINDEX(N'%{0}%', Email) > 0 OR PATINDEX(N'%{0}%', PhoneNumber) > 0)", searchfield) },
                        { "Active", 0 },
                        { "StaffId", string.Format("$x > 0") }
                    },
                    _f = String.Join(",", typeof(tbl_UserAuth).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
                };
            }

            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_UserAuth>();
                result            = result.OrderByDescending(x => x.CreatedDate).ToList();
                ViewBag.RecordNum = robj.TotalRecordCount;

                ViewBag.CurrentPage = 1;
                ViewBag.TotalPage   = 0;

                return(View(result));
            }
            ViewBag.RecordNum = 0;
            return(View());
        }
Пример #9
0
        public ActionResult Job_Sub()
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            //Get Job
            var obj = new GCRequest
            {
                _a = "fGettbl_Job", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Status", 1 },
                    { "NganhId", string.Format("$x is Null") }
                },
                _f = String.Join(",", typeof(tbl_Job).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_Job>();
                result      = result.OrderBy(x => x.Name).ToList();
                ViewBag.Job = result;
            }
            //----------------

            //Get Job-sub
            var objViec = new GCRequest
            {
                _a = "fGettbl_Job_View01", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Status", 1 },
                    { "NganhIdStatus", 1 },
                    { "NganhId", string.Format("$x is NOT Null") }
                },
                _f = String.Join(",", typeof(tbl_Job_View01).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjViec = service.P(objViec); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            if (robjViec.Result.Equals(1) && robjViec.Records.Any())
            {
                var result = robjViec.Records.ConvertToList <tbl_Job_View01>();
                result = result.OrderBy(x => x.Name).ToList();
                return(View(result));
            }
            //--------------

            return(View());
        }
Пример #10
0
        public JsonResult AddNganh(tbl_Job md)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj     = new GCRequest
            {
                _a = "Inserttbl_Job", //Action prefix f,p for get data; gc_App is table name
                _d = new Dictionary <string, object>
                {
                    { "Name", md.Name },
                    { "Code", md.Code }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            return(Json(robj.Result));
        }
Пример #11
0
        public ActionResult Login(tbl_Admin_UserAuth md)
        {
            var error = String.Empty;

            if (md.UserName != null || md.UserName != "")
            {
                var convertPass = WebsiteExtension.EncryptPassword(md.PasswordHash);
                try
                {
                    var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

                    var objCheckExist = new GCRequest
                    {
                        _a = "fGettbl_Admin_UserAuth", //Action prefix f,p for get data; gc_App is table name
                        _c = new Dictionary <string, object>
                        {
                            { "UserName", md.UserName },
                            { "PasswordHash", convertPass },
                            { "Status", 1 }
                        },
                        _f = "Id,TypeId,UserName,GroupTypeId"
                    };
                    var robjCheckExist = service.P(objCheckExist);
                    if (robjCheckExist.TotalRecordCount > 0)
                    {
                        Session["UserID"]   = robjCheckExist.Records[0][0].ToString();
                        Session["RoleId"]   = robjCheckExist.Records[0][1].ToString();
                        Session["UserName"] = robjCheckExist.Records[0][2].ToString();
                        Session["GroupId"]  = robjCheckExist.Records[0][3].ToString();
                        Session.Timeout     = 120;
                        return(Redirect("/"));
                    }
                    else
                    {
                        return(Redirect("/Login/Login"));
                    }
                }
                catch (Exception ex)
                {
                    return(Redirect("/Login/Login"));
                }
            }
            else
            {
                return(Redirect("/Login/Login"));
            }
        }
Пример #12
0
        public ActionResult _ProjectTabPartial(int id)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            //Get Project
            var obj = new GCRequest
            {
                _a = "fGettbl_User_Project_View00", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", id },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_User_Project_View).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_User_Project_View>();
                ViewBag.Project = result;
            }
            //---------------------------------------------

            //Get Experience List
            var objKinhNghiem = new GCRequest
            {
                _a = "fGettbl_User_Experience_View01", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", id },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_User_Experience_View).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjKinhNghiem = service.P(objKinhNghiem);

            if (robjKinhNghiem.Result.Equals(1) && robjKinhNghiem.Records.Any())
            {
                var result = robjKinhNghiem.Records.ConvertToList <tbl_User_Experience_View>();
                return(PartialView(result));
            }
            //------------------------------------------------
            return(PartialView());
        }
Пример #13
0
        public JsonResult DeleteProject(int id)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj     = new GCRequest
            {
                _a = "Updatetbl_User_Project", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", id }
                },
                _d = new Dictionary <string, object>
                {
                    { "Status", 0 }
                }
            };
            var robj = service.P(obj);

            return(Json(robj.Result));
        }
Пример #14
0
        public JsonResult DeleteAccount(tbl_UserAuth md)
        {
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            var obj = new GCRequest
            {
                _a = "Updatetbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id }
                },
                _d = new Dictionary <string, object>
                {
                    { "Status", 0 }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            return(Json(robj.Result));
        }
Пример #15
0
        public JsonResult CheckUser(tbl_UserAuth md)
        {
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj = new GCRequest
            {
                _a = "fGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserName", md.UserName }
                },
                _f = "Id"
            };
            var robj = service.P(obj);

            if (robj.TotalRecordCount > 0)
            {
                return(Json(1));
            }
            return(Json(0));
        }
Пример #16
0
        public ActionResult ChangePass(tbl_Admin_UserAuth md, string OldPassWord)
        {
            var convertPass = WebsiteExtension.EncryptPassword(md.PasswordHash);
            var service     = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            var objCheckPass = new GCRequest
            {
                _a = "fGettbl_Admin_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserName", md.UserName },
                    { "PasswordHash", WebsiteExtension.EncryptPassword(OldPassWord) },
                    { "Status", 1 }
                },
                _f = "Id"
            };
            var robjCheckPass = service.P(objCheckPass);

            if (robjCheckPass.TotalRecordCount > 0)
            {
                var obj = new GCRequest
                {
                    _a = "Updatetbl_Admin_UserAuth", //Action prefix f,p for get data; gc_App is table name
                    _c = new Dictionary <string, object>
                    {
                        { "Id", md.Id }
                    },
                    _d = new Dictionary <string, object>
                    {
                        { "PasswordHash", convertPass },
                        { "ModifiedDate", DateTime.Now }
                    }
                };
                var robj = service.P(obj);
                if (robj.Result == 1)
                {
                    return(Redirect("/Login/Login"));
                }
            }
            return(View());
        }
Пример #17
0
        public JsonResult DeleteRecruitPost(tbl_Recruitment_Post md)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj     = new GCRequest
            {
                _a = "Updatetbl_Recruitment_Post", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id }
                },
                _d = new Dictionary <string, object>
                {
                    { "Status", 0 },
                    { "StaffIdUpdate", md.StaffIdUpdate },
                    { "UpdateDate", DateTime.Now }
                }
            };
            var robj = service.P(obj);

            return(Json(robj.Result));
        }
Пример #18
0
        public static object DeleteNews(int id)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true);
            var obj     = new GCRequest
            {
                _a = "Updatetbl_News", //Action prefix f,p for get data; tbl_PT_MailBox is table name
                _d = new Dictionary <string, object>
                {
                    { "Status", 0 },
                    { "UpdateStaffId", HttpContext.Current.Session["UserID"] },
                    { "UpdateDate", DateTime.Now }
                },
                _c = new Dictionary <string, object>
                {
                    { "Id", id }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            return(robj.Result);
        }
Пример #19
0
        public static List <tbl_News> GetNews()
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true);
            var obj     = new GCRequest
            {
                _a = "fGettbl_News", //Action prefix f,p for get data; tbl_PT_MailBox is table name
                _c = new Dictionary <string, object>
                {
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_News).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_News>();
                return(result);
            }
            return(null);
        }
Пример #20
0
        public ActionResult Employer_Info(int id)
        {
            //Get ky nang
            var objSkill = new GCRequest
            {
                _a = "fGettbl_Recruitment_Post", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", id },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_Recruitment_Post).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjSkill = service.P(objSkill);

            if (robjSkill.Result.Equals(1) && robjSkill.Records.Any())
            {
                var result = robjSkill.Records.ConvertToList <tbl_Recruitment_Post>();
                ViewBag.RecruitmentPost = result;
            }

            // Get thong tin
            var obj = new GCRequest
            {
                _a = "fGettbl_UserAuth_View00", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", id }
                },
                _f = String.Join(",", typeof(tbl_UserAuth_View00).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_UserAuth_View00>();
                return(View(result));
            }
            return(View());
        }
Пример #21
0
        public ActionResult JobPost_Edit(tbl_Recruitment_Post md)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj     = new GCRequest
            {
                _a = "Updatetbl_Recruitment_Post", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id }
                },
                _d = new Dictionary <string, object>
                {
                    { "TypeId", md.TypeId },
                    { "TypeIdName", md.TypeIdName },
                    { "Title", md.Title },
                    { "PositionId", md.PositionId },
                    { "Job", md.Job },
                    { "JobName", md.JobName },
                    { "Location", md.Location },
                    { "LocationName", md.LocationName },
                    { "Wage", md.Wage },
                    { "TrialTime", md.TrialTime },
                    { "Num", md.Num },
                    { "Experience", md.Experience },
                    { "Diploma", md.Diploma },
                    { "Gender", md.Gender },
                    { "Age", md.Age },
                    { "Describe", md.Describe },
                    { "Interest", md.Interest },
                    { "Other", md.Other },
                    { "Folder", md.Folder },
                    { "EndDate", md.EndDate },
                    { "StaffIdUpdate", md.StaffIdUpdate },
                    { "UpdateDate", DateTime.Now }
                }
            };
            var robj = service.P(obj);

            return(View(robj.Result));
        }
Пример #22
0
        public JsonResult GetCongViecByNganhId(int nganhId)
        {
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj = new GCRequest
            {
                _a = "fGettbl_Job", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "NganhId", nganhId },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_Job).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_Job>();
                return(Json(result));
            }
            return(Json(0));
        }
Пример #23
0
        public ActionResult CreateAccount(tbl_UserAuth md)
        {
            var convertPass = WebsiteExtension.EncryptPassword(md.PasswordHash);
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj = new GCRequest
            {
                _a = "Inserttbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _d = new Dictionary <string, object>
                {
                    { "TypeId", md.TypeId },
                    { "UserName", md.UserName.ToLower() },
                    { "PasswordHash", convertPass },
                    { "StaffId", md.StaffId },
                    { "Status", 1 },
                    { "CreatedDate", DateTime.Now }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            ViewBag.result = robj.Result;
            ViewBag.type   = md.TypeId;
            return(View(robj.Records[0][0]));
        }
Пример #24
0
        public ActionResult Account(int page = 1)
        {
            ViewBag.RecordNum = null;
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            var obj = new GCRequest();

            var staffId = int.Parse(Session["UserId"].ToString());

            if (staffId == 3 || staffId == 4)
            {
                obj = new GCRequest
                {
                    _a = "pGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                    _c = new Dictionary <string, object>
                    {
                        { "TypeId", 2 },
                        { "Status", 1 },
                        { "StaffId", string.Format("$x > 0") }
                    },
                    _od = new Dictionary <string, string>()
                    {
                        { "CreatedDate", "DESC" }
                    },
                    _os = (page - 1) * 10,
                    _lm = 10,
                    _f  = String.Join(",", typeof(tbl_UserAuth).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
                };
            }
            else
            {
                obj = new GCRequest
                {
                    _a = "pGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                    _c = new Dictionary <string, object>
                    {
                        { "Status", 1 },
                        { "StaffId", string.Format("$x > 0") }
                    },
                    _od = new Dictionary <string, string>()
                    {
                        { "CreatedDate", "DESC" }
                    },
                    _os = (page - 1) * 10,
                    _lm = 10,
                    _f  = String.Join(",", typeof(tbl_UserAuth).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
                };
            }

            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_UserAuth>();
                result = result.OrderByDescending(x => x.CreatedDate).ToList();

                var totalPage = Convert.ToInt32(Math.Ceiling((double)robj.TotalRecordCount / 10));
                ViewBag.CurrentPage = page;
                ViewBag.TotalPage   = totalPage;

                return(View(result));
            }
            return(View());
        }
Пример #25
0
        public ActionResult Seeker_Info(int id)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            //Get ky nang
            var objSkill = new GCRequest
            {
                _a = "fGettbl_User_Experience_View01", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", id },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_User_Experience_View).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjSkill = service.P(objSkill);

            if (robjSkill.Result.Equals(1) && robjSkill.Records.Any())
            {
                var result = robjSkill.Records.ConvertToList <tbl_User_Experience_View>();
                ViewBag.Skill = result;
            }

            // Get kinh nghiem
            var objExp = new GCRequest
            {
                _a = "fGettbl_User_Project_View00", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", id },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_User_Project_View).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjExp = service.P(objExp);

            if (robjExp.Result.Equals(1) && robjExp.Records.Any())
            {
                var result = robjExp.Records.ConvertToList <tbl_User_Project_View>();
                ViewBag.Exp = result;
            }

            // Get thong tin
            var obj = new GCRequest
            {
                _a = "fGettbl_UserAuth_View00", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", id }
                },
                _f = String.Join(",", typeof(tbl_UserAuth_View00).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_UserAuth_View00>();
                return(View(result));
            }
            return(View());
        }
Пример #26
0
        public ActionResult CreateNewJob(int?id)
        {
            if (!id.HasValue)
            {
                return(Redirect("/"));
            }

            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            // Get vi tri
            var objPosition = new GCRequest
            {
                _a = "fGettbl_Position", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_Position).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjPosition = service.P(objPosition); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            if (robjPosition.Result.Equals(1) && robjPosition.Records.Any())
            {
                var result = robjPosition.Records.ConvertToList <tbl_Position>();
                result           = result.OrderBy(x => x.Name).ToList();
                ViewBag.Position = result;
            }

            //Get Job
            var objJob = new GCRequest
            {
                _a = "fGettbl_Job", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Status", 1 },
                    { "NganhId", string.Format("$x is Null") }
                },
                _f = String.Join(",", typeof(tbl_Job).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjJob = service.P(objJob); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            if (robjJob.Result.Equals(1) && robjJob.Records.Any())
            {
                var result = robjJob.Records.ConvertToList <tbl_Job>();
                result      = result.OrderBy(x => x.Name).ToList();
                ViewBag.Job = result;
            }

            //Get Province List
            var objProvince = new GCRequest
            {
                _a = "fGettbl_Provinces", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "InUse", 1 }
                },
                _f = String.Join(",", typeof(tbl_Provinces).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjProvince = service.P(objProvince);

            if (robjProvince.Result.Equals(1) && robjProvince.Records.Any())
            {
                var result = robjProvince.Records.ConvertToList <tbl_Provinces>();
                ViewBag.Province = result;
            }

            return(View(2));
        }
Пример #27
0
        public ActionResult Index()
        {
            var      fromDate = DateTime.Today.AddDays(-5);
            var      toDate   = DateTime.Today;
            DateTime dateNow  = DateTime.Now;

            var obj = new GCRequest
            {
                _a = "fGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_UserAuth).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj);

            var objSoluongNhaplieu = new GCRequest
            {
                _a = "fGettbl_UserAuth_SummaryByDay_View", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "CreatedDate", string.Format("$x >= '{0:yyyy-MM-dd}'", dateNow.AddDays(-5)) }
                },
                _f = String.Join(",", typeof(tbl_UserAuth_SummaryByDay_View).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjSoluongNhaplieu = service.P(objSoluongNhaplieu);

            if (robjSoluongNhaplieu.Result.Equals(1) && robjSoluongNhaplieu.Records.Any())
            {
                var result = robjSoluongNhaplieu.Records.ConvertToList <tbl_UserAuth_SummaryByDay_View>();

                ViewBag.DayList = result.Select(x => x.CreatedDate.ToString("dd/MM/yyyy")).Distinct().ToArray();


                //Get data by dict
                //var dict = new Dictionary<int, List<int>>();
                var dict = new Dictionary <int, Dictionary <DateTime, int> >();
                foreach (var item in result)
                {
                    var staffID = item.StaffId;
                    if (!dict.ContainsKey(staffID))
                    {
                        var d = new Dictionary <DateTime, int>();
                        for (var i = 0; i < (toDate - fromDate).TotalDays; i++)
                        {
                            d.Add(fromDate.AddDays(i), 0);
                        }
                        dict.Add(staffID, d);
                    }
                    dict[staffID][item.CreatedDate] = item.Total;
                }
                ViewBag.array = dict;

                //Get data by Json
                //var users = result.Select(c => c.CreatedDate).Distinct().ToList();
                //var data = new CreatingUserChartDto();
                //foreach(var item in result.GroupBy(c => c.StaffId).OrderBy(c => c.Key)){
                //    var serier = new List<int>();
                //    foreach (var user in users)
                //    {
                //    data.Labels.Add(user.ToString("dd/MM/yyyy"));
                //        var totalOfUser = item.FirstOrDefault(c => c.CreatedDate == user);
                //        if(totalOfUser != null)
                //        {
                //            serier.Add(totalOfUser.Total);
                //        }
                //        else
                //        {
                //            serier.Add(0);
                //        }
                //    }
                //    data.Seriers.Add(serier);
                //}
                //ViewBag.Chart = JsonConvert.SerializeObject(data);

                //var t = result.
                //var t = result.OrderBy(c => c.TypeId).ThenBy(c => c.CreatedDate)
                //    .GroupBy(c => c.TypeId).Select(g => new Dictionary<int, List<int>>()
                //    {
                //        g.Key,
                //        g.GroupBy(h => h.CreatedDate).Count()
                //    })
                //    .Select(c => c.Select(d => d)).ToList();

                //List<List<int>> array = new List<List<int>>();
                //foreach (var item in result)
                //{

                //}
            }

            return(View(robj.TotalRecordCount));
        }
Пример #28
0
        public JsonResult AddKinhNghiem(tbl_User_Experience md)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            // Check kinh nghiem
            var objCheck = new GCRequest
            {
                _a = "fGettbl_User_Experience", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", md.UserId },
                    { "NganhId", md.NganhId },
                    { "KieuString1", md.KieuString1 }
                    //{ "LoaiViecId",md.LoaiViecId}
                },
                _f = String.Join(",", typeof(tbl_User_Experience).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjCheck = service.P(objCheck);

            //-----------------------------------------------------

            // If exist : Update
            if (robjCheck.TotalRecordCount > 0)
            {
                var obj = new GCRequest
                {
                    _a = "Updatetbl_User_Experience", //Action prefix f,p for get data; gc_App is table name
                    _c = new Dictionary <string, object>
                    {
                        { "UserId", md.UserId },
                        { "NganhId", md.NganhId },
                        { "KieuString1", md.KieuString1 }
                        //{ "LoaiViecId",md.LoaiViecId}
                    },
                    _d = new Dictionary <string, object>
                    {
                        { "NumOfYear", md.NumOfYear },
                        { "Status", 1 },
                        { "UpdateDate", DateTime.Now }
                    }
                };
                var robj = service.P(obj);
                return(Json(robj.Result));
            }
            // If null : Insert
            else
            {
                var obj = new GCRequest
                {
                    _a = "Inserttbl_User_Experience", //Action prefix f,p for get data; gc_App is table name
                    _d = new Dictionary <string, object>
                    {
                        { "UserId", md.UserId },
                        { "NganhId", md.NganhId },
                        { "KieuString1", md.KieuString1 },
                        //{ "LoaiViecId",md.LoaiViecId},
                        { "NumOfYear", md.NumOfYear },
                        { "CreateDate", DateTime.Now }
                    }
                };
                var robj = service.P(obj);
                return(Json(robj.Result));
            }
            //----------------------------------------------
        }
Пример #29
0
        public JsonResult GetNumAccCreatedIn5Days()
        {
            DateTime dateNow            = DateTime.Now;
            var      fromDate           = DateTime.Today.AddDays(-10);
            var      toDate             = DateTime.Today;
            var      objSoluongNhaplieu = new GCRequest
            {
                _a = "fGettbl_UserAuth_SummaryByDay_View", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "TypeId", 2 },
                    { "CreatedDate", string.Format("$x >= '{0:yyyy-MM-dd}'", dateNow.AddDays(-10)) }
                },
                _f = String.Join(",", typeof(tbl_UserAuth_SummaryByDay_View).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjSoluongNhaplieu = service.P(objSoluongNhaplieu);

            if (robjSoluongNhaplieu.Result.Equals(1) && robjSoluongNhaplieu.Records.Any())
            {
                var result = robjSoluongNhaplieu.Records.ConvertToList <tbl_UserAuth_SummaryByDay_View>();

                ViewBag.DayList = result.Select(x => x.CreatedDate.ToString("dd/MM/yyyy")).Distinct().ToArray();

                //Get data by dict
                var dict = new Dictionary <int, Dictionary <DateTime, int> >();
                foreach (var item in result)
                {
                    var staffID = item.StaffId;
                    if (!dict.ContainsKey(staffID))
                    {
                        var d = new Dictionary <DateTime, int>();
                        for (var i = 0; i < (toDate - fromDate).TotalDays; i++)
                        {
                            d.Add(fromDate.AddDays(i), 0);
                        }
                        dict.Add(staffID, d);
                    }
                    dict[staffID][item.CreatedDate] = item.Total;
                }

                var content = JsonConvert.SerializeObject(dict.Select(c => c.Value.Select(e => e.Value).ToList()).ToList());

                List <string>      dateList = new List <string>();
                List <List <int> > seriers  = new List <List <int> >();
                foreach (var item in dict)
                {
                    var serier = new List <int>();
                    foreach (var d in item.Value)
                    {
                        serier.Add(d.Value);
                    }

                    seriers.Add(serier);
                }
                foreach (var item in dict.Take(1))
                {
                    foreach (var d in item.Value)
                    {
                        dateList.Add(d.Key.Date.ToString("dd/MM/yyyy"));
                    }
                }
                return(Json(new { datelist = dateList, seriers = seriers, content = content }));

                //Get data by Json
                //var users = result.Select(c => c.CreatedDate).Distinct().ToList();
                //var data = new CreatingUserChartDto();
                //foreach (var item in result.GroupBy(c => c.StaffId).OrderBy(c => c.Key))
                //{
                //    var serier = new List<int>();
                //    foreach (var user in users)
                //    {
                //        data.Labels.Add(user.ToString("dd/MM/yyyy"));
                //        var totalOfUser = item.FirstOrDefault(c => c.CreatedDate == user);
                //        if (totalOfUser != null)
                //        {
                //            serier.Add(totalOfUser.Total);
                //        }
                //        else
                //        {
                //            serier.Add(0);
                //        }
                //    }
                //    data.Seriers.Add(serier);
                //}
                //return Json(JsonConvert.SerializeObject(data));
            }
            return(null);
        }
Пример #30
0
        public ActionResult Account_Detail(int?id)
        {
            var staffId = int.Parse(Session["UserId"].ToString());

            if (!id.HasValue)
            {
                return(Redirect("/"));
            }
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            //Get account
            var objType = new GCRequest
            {
                _a = "fGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", id },
                    { "Status", 1 }
                },
                _f = "TypeId"
            };
            var robjType = service.P(objType);

            if (int.Parse(robjType.Records[0][0].ToString()) == 1)
            {
                return(Redirect("/"));
            }

            //Get Experience List
            var objKinhNghiem = new GCRequest
            {
                _a = "fGettbl_User_Experience_View01", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserId", id },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_User_Experience_View).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robjKinhNghiem = service.P(objKinhNghiem);

            if (robjKinhNghiem.Result.Equals(1) && robjKinhNghiem.Records.Any())
            {
                var result = robjKinhNghiem.Records.ConvertToList <tbl_User_Experience_View>();
                ViewBag.KinhNghiemList = result;
            }
            //------------------------------------------------

            //Get Job List
            var obj = new GCRequest
            {
                _a = "fGettbl_Job", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "NganhId", string.Format("$x is Null") },
                    { "Status", 1 }
                },
                _f = String.Join(",", typeof(tbl_Job).GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(c => c.Name))
            };
            var robj = service.P(obj);

            if (robj.Result.Equals(1) && robj.Records.Any())
            {
                var result = robj.Records.ConvertToList <tbl_Job>();
                return(View(result));
            }
            //-----------------------------------
            return(View());
        }