private void PK_CustomerMapFormatCell(List <tblCustomer_Excel> listData, string filename = "", string sheetname = "", string comments = "", string titleSheet = "", string titleTime = "")
        {
            //Nội dung đầu trang
            var user = GetCurrentUser.GetUser();

            var timeSearch = "";

            if (!string.IsNullOrWhiteSpace(titleTime))
            {
                timeSearch = "Từ " + titleTime.Split(new[] { '-' })[0] + " đến " + titleTime.Split(new[] { '-' })[1];
            }

            var dtHeader = _tblSystemConfigService.getHeaderExcel(titleSheet, timeSearch, user.Username);

            //Header
            var listColumn = new List <SelectListModel>();

            listColumn.Add(new SelectListModel {
                ItemText = "STT", ItemValue = "NumberRow"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Mã khách hàng", ItemValue = "CustomerCode"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Khách hàng", ItemValue = "CustomerName"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Chứng minh thư", ItemValue = "CustomerIdentify"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Địa chỉ", ItemValue = "CustomerAddress"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Số điện thoại", ItemValue = "CustomerMobile"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Nhóm khách hàng", ItemValue = "CustomerGroupName"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Mã thẻ (Số thẻ)", ItemValue = "Cards"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Biển số", ItemValue = "Plates"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Hoạt động", ItemValue = "Active"
            });

            //Chuyển dữ liệu về datatable
            DataTable dt = listData.ToDataTableNullable();

            //Xuất file
            ExportFile(dt, listColumn, dtHeader, filename, sheetname, comments);
        }
        /// <summary>
        /// Xóa
        /// </summary>
        /// <modified>
        /// Author              Date            Comments
        /// TrungNQ             16/09/2017      Tạo mới
        /// </modified>
        /// <param name="id">Id bản ghi</param>
        /// <returns></returns>
        public JsonResult Delete(int id)
        {
            var result = _tblAccessTimezoneService.DeleteById(id);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), id.ToString(), id.ToString(), "tblAccessTimezone", ConstField.AccessControlCode, ActionConfigO.Delete);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ResponseMessageWrap <object> QueryPageDataByOrg([FromBody] QueryByPageRequest reqMsg)
        {
            UserInfo user = GetCurrentUser.GetUserInfo(Request.HttpContext);

            reqMsg.groupId = user.group_id;
            var total = _sysUserService.QueryDataRecord(reqMsg);
            var list  = _sysUserService.QueryDataByPage(reqMsg);

            return(new ResponseMessageWrap <object> {
                count = total, data = list
            });
        }
示例#4
0
        public MessageReport CreateSql(tblLocker obj, string actionV, string message, string type = "0")
        {
            var re = new MessageReport();

            re.Message   = "Error";
            re.isSuccess = false;

            try
            {
                var sb = new StringBuilder();
                sb.AppendLine("INSERT INTO dbo.[tblLockerProcess] (");

                sb.AppendLine("Id");
                sb.AppendLine(", LockerName");
                sb.AppendLine(", LockerReaderIndex");
                sb.AppendLine(", ControllerID");
                sb.AppendLine(", CardNumber");
                sb.AppendLine(", CardNo");
                sb.AppendLine(", DateCreated");
                sb.AppendLine(", UserId");
                sb.AppendLine(", ActionLocker");
                sb.AppendLine(", Type");
                sb.AppendLine(", Description");
                sb.AppendLine(") VALUES (");

                sb.AppendLine(string.Format("  N'{0}'", Guid.NewGuid().ToString()));
                sb.AppendLine(string.Format(", N'{0}'", obj.Name));
                sb.AppendLine(string.Format(", '{0}'", obj.ReaderIndex));

                sb.AppendLine(string.Format(", '{0}'", obj.ControllerID));
                sb.AppendLine(string.Format(", '{0}'", obj.CardNumber));
                sb.AppendLine(string.Format(", '{0}'", obj.CardNo));

                sb.AppendLine(string.Format(", '{0}'", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
                sb.AppendLine(string.Format(", '{0}'", GetCurrentUser.GetUser().Id));
                sb.AppendLine(string.Format(", '{0}'", actionV));
                sb.AppendLine(string.Format(", '{0}'", type));
                sb.AppendLine(string.Format(", '{0}'", message));
                sb.AppendLine(")");

                ExcuteSQL.Execute(sb.ToString());

                re.Message   = "Thêm mới thành công";
                re.isSuccess = true;
            }
            catch (Exception ex)
            {
                re.Message   = ex.Message;
                re.isSuccess = false;
            }

            return(re);
        }
        public ActionResult Update(tblCompartment obj, int page = 1, string group = "", string key = "")
        {
            //
            ViewBag.PN         = page;
            ViewBag.groupValue = group;
            ViewBag.keyValue   = key;

            //Kiểm tra
            var oldObj = _tblCompartmentService.GetById(obj.CompartmentID);

            if (oldObj == null)
            {
                ViewBag.Error = "Bản ghi không tồn tại";
                return(View(obj));
            }

            if (string.IsNullOrWhiteSpace(obj.CompartmentName))
            {
                ModelState.AddModelError("CompartmentName", "Vui lòng căn hộ");
                return(View(oldObj));
            }

            if (!ModelState.IsValid)
            {
                return(View(oldObj));
            }

            var objExisted = _tblCompartmentService.GetByName(obj.CompartmentName);

            if (objExisted.Where(n => !n.CompartmentID.Equals(obj.CompartmentID)).Any())
            {
                ViewBag.Error = "Bản ghi đã tồn tại";
                return(View(oldObj));
            }

            oldObj.CompartmentName = obj.CompartmentName;
            oldObj.SortOrder       = obj.SortOrder;

            //Thực hiện cập nhật
            var result = _tblCompartmentService.Update(oldObj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.CompartmentID.ToString(), obj.CompartmentName, "tblCompartment", ConstField.ParkingCode, ActionConfigO.Update);

                return(RedirectToAction("Index", new { group = group, key = key, page = page, selectedId = obj.CompartmentID }));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(oldObj));
            }
        }
        public ActionResult Create(tblController obj, string key, string pc, string group = "", bool SaveAndCountinue = false)
        {
            ViewBag.PCs = GetPCList();

            ViewBag.keyValue   = key;
            ViewBag.pcValue    = pc;
            ViewBag.groupValue = group;

            ViewBag.CommunicationType = FunctionHelper.Communication1();
            ViewBag.LineType          = FunctionHelper.LineTypes1();
            ViewBag.Read = FunctionHelper.ReaderTypes1();

            if (!ModelState.IsValid)
            {
                return(View(obj));
            }

            if (string.IsNullOrWhiteSpace(obj.ControllerName))
            {
                ModelState.AddModelError("ControllerName", FunctionHelper.GetLocalizeDictionary("Home", "notification")["Controller_Name"]);
                return(View(obj));
            }

            var existed = _tblControllerService.GetByName(obj.ControllerName);

            if (existed != null)
            {
                ModelState.AddModelError("ControllerName", FunctionHelper.GetLocalizeDictionary("Home", "notification")["Controller_Name_already_exists"]);
                return(View(obj));
            }

            obj.ControllerID = Guid.NewGuid();

            //Thực hiện thêm mới
            var result = _tblControllerService.Create(obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.ControllerID.ToString(), obj.ControllerName, "tblController", ConstField.ParkingCode, ActionConfigO.Create);

                if (SaveAndCountinue)
                {
                    TempData["Success"] = result.Message;
                    return(RedirectToAction("Create", new { group = group, key = key, pc = pc, selectedId = obj.ControllerID }));
                }

                return(RedirectToAction("Index", new { group = group, key = key, pc = pc, selectedId = obj.ControllerID }));
            }
            else
            {
                return(View(obj));
            }
        }
        public void OnAuthorization(AuthorizationContext filterContext)
        {
            if (!GetCurrentUser.CheckCurrentLogin())
            {
                filterContext.Result = new RedirectResult("/Login");
            }

            //if (SecureDongleProvider.CheckHardKey() == false)
            //{
            //    filterContext.Result = new RedirectResult("/Login");
            //}
        }
示例#8
0
        public ActionResult Index()
        {
            LoggedUserModel lgm        = GetCurrentUser.GetUser();
            string          gorevQuery = "select g.isim as gorev_ismi, ps.isim as proje_ismi, g.baslangic_tarihi, g.bitis_tarihi, g.yuzde, g.flag as gorev_flag, ps.tur, g.url from gorevler as g "
                                         + "left join gorev_proje as gp on gp.gorev_id = g.id and gp.flag = " + durumlar.aktif.ToString() + " "
                                         + "left join proje_surec as ps on ps.id = gp.proje_id and ps.flag = " + durumlar.aktif.ToString() + " "
                                         + "where g.flag != " + durumlar.silindi.ToString() + " order by g.bitis_tarihi";

            List <GorevVeProjeOzetModel> gorevList = db.Database.SqlQuery <GorevVeProjeOzetModel>(gorevQuery).ToList();

            return(View(gorevList));
        }
        public ActionResult Index()
        {
            //if (String.IsNullOrEmpty(HttpContext.User.Identity.Name) || !User.Identity.IsAuthenticated)
            LoggedUserModel lum = GetCurrentUser.GetUser();

            if (lum == null || !(lum.kullanici_turu == KullaniciTurleri.super_admin))
            {
                FormsAuthentication.SignOut();
                return(View());
            }
            return(Redirect("/Admin/AHome"));
        }
示例#10
0
        public async Task <ActionResult> GorevleriGetir(string id)//id proje url yerine geçiyor
        {
            LoggedUserModel lgm        = GetCurrentUser.GetUser();
            string          gorevQuery = "select g.isim as gorev_ismi, ps.isim as proje_ismi, g.baslangic_tarihi, g.bitis_tarihi, g.yuzde, g.flag as gorev_flag, ps.tur, g.url from gorevler as g "
                                         + "left join gorev_proje as gp on gp.gorev_id = g.id and gp.flag = " + durumlar.aktif.ToString() + " "
                                         + "left join proje_surec as ps on ps.id = gp.proje_id and ps.flag = " + durumlar.aktif.ToString() + " "
                                         + "where g.flag != " + durumlar.silindi.ToString() + (id != null ? (" and ps.url = '" + id + "'") : ("")) + " order by g.bitis_tarihi";

            List <GorevVeProjeOzetModel> gorevList = db.Database.SqlQuery <GorevVeProjeOzetModel>(gorevQuery).ToList();

            return(View(gorevList));
        }
示例#11
0
        public ResponseMessage <int> Update([FromBody] SysUser sysUser)
        {
            UserInfo user = GetCurrentUser.GetUserInfo(Request.HttpContext);

            sysUser.updated_by   = user.id;
            sysUser.updated_time = DateTime.Now;
            SysUser entity = _sysUserService.GetById(sysUser.id);

            Utils.CommmonUtils.EntityToEntity(sysUser, entity, null);
            return(new ResponseMessage <int> {
                data = _sysUserService.Update(entity)
            });
        }
        /// <summary>
        /// Xóa
        /// </summary>
        /// <modified>
        /// Author              Date            Comments
        /// TrungNQ             01/09/2017      Tạo mới
        /// </modified>
        /// <param name="id">Id bản ghi</param>
        /// <returns></returns>
        public JsonResult Delete(string id)
        {
            var obj = new tblCompartment();

            var result = _tblCompartmentService.DeleteById(id, ref obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.CompartmentID.ToString(), obj.CompartmentName, "tblCompartment", ConstField.ParkingCode, ActionConfigO.Delete);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Delete(string id)
        {
            var obj = new BM_Floor();

            var result = _BM_FloorService.DeleteById(id, ref obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.Id.ToString(), obj.Name, "BM_Floor", ConstField.ResidentCode, ActionConfigO.Delete);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#14
0
        public JsonResult MutilDelete(string lstId)
        {
            bool isSucccess = _MenuFunctionService.DeleteByIds(lstId);

            if (isSucccess)
            {
                CacheLayer.ClearAll();

                MessageReport report = new MessageReport(true, FunctionHelper.GetLocalizeDictionary("Home", "notification")["DeleteSuccess"]);
                WriteLog.Write(report, GetCurrentUser.GetUser(), lstId, lstId, "MenuFunction");
            }
            return(Json(isSucccess, JsonRequestBehavior.AllowGet));
        }
示例#15
0
        public JsonResult Delete(string id)
        {
            var obj = new tblCardGroup();

            var result = _tblCardGroupService.DeleteById(id, ref obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.CardGroupID.ToString(), obj.CardGroupName, "tblCardGroup", ConstField.AccessControlCode, ActionConfigO.Delete);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#16
0
        public ActionResult Create(tblLocker obj, bool SaveAndCountinue = false)
        {
            ViewBag.urlValue    = url ?? Request.Url.PathAndQuery;
            ViewBag.Controllers = GetControllerList();

            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Tạo dữ liệu không thành công. Hãy kiểm tra lại dữ liệu nhập vào");
                return(View(obj));
            }

            var existed = _tblLockerService.GetByName(obj.Name);

            if (existed != null)
            {
                ModelState.AddModelError("Name", "Tên tủ đồ đã bị trùng");
                return(View(obj));
            }

            var existedIndex = _tblLockerService.GetByControllerID_ReaderIndex(obj.ControllerID, obj.ReaderIndex);

            if (existedIndex != null)
            {
                ModelState.AddModelError("ReaderIndex", "Tên tủ đồ đang để trùng địa chỉ reader");
                return(View(obj));
            }

            obj.Id          = Guid.NewGuid().ToString();
            obj.DateCreated = DateTime.Now;
            obj.LockerType  = "0";

            var report = _tblLockerService.Create(obj);

            if (report.isSuccess)
            {
                WriteLog.Write(report, GetCurrentUser.GetUser(), obj.Id.ToString(), obj.Name, "tblLocker", ConstField.LockerCode, ActionConfigO.Create);

                TempData["Success"] = report.Message;
                if (SaveAndCountinue)
                {
                    return(RedirectToAction("Create"));
                }

                return(Redirect(url));
            }
            else
            {
                ModelState.AddModelError("", "Tạo dữ liệu không thành công. Hãy kiểm tra lại dữ liệu nhập vào");
                return(View(obj));
            }
        }
示例#17
0
        /// <summary>
        /// Format xuất excel báo cáo cảnh báo tủ đồ
        /// </summary>
        /// <param name="dtData"></param>
        /// <param name="excelcol"></param>
        /// <param name="filename"></param>
        /// <param name="sheetname"></param>
        /// <param name="comments"></param>
        /// <param name="titleSheet"></param>
        /// <param name="titleTime"></param>
        private void ReportLokerAlarm_FormatCell(DataTable dtData, string excelcol, string filename = "", string sheetname = "", string comments = "", string titleSheet = "", string titleTime = "")
        {
            //Nội dung đầu trang
            var user = GetCurrentUser.GetUser();

            var timeSearch = "";

            if (!String.IsNullOrEmpty(titleTime))
            {
                timeSearch = "Từ ngày" + ": " + titleTime.Split(new[] { '-' })[0] + " - " + "Đến ngày" + ": " + titleTime.Split(new[] { '-' })[1];
            }

            var dtHeader = _tblSystemConfigService.getHeaderExcel(titleSheet, timeSearch, user.Username);

            //Header
            var listColumn = new List <SelectListModel>();

            listColumn.Add(new SelectListModel {
                ItemText = "STT", ItemValue = "STT"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Số thẻ", ItemValue = "CardNo"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Mã thẻ", ItemValue = "Mã thẻ"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Nhóm thẻ", ItemValue = "Tên tủ đô"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Bộ điều khiển", ItemValue = "Bộ điều khiển"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Ngăn", ItemValue = "Vị trí tủ"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Sự kiện", ItemValue = "Sự kiện"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Loại sự kiện", ItemValue = "Kiểu sự kiện"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Cảnh báo", ItemValue = "Alarm"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Ngày thao tác", ItemValue = "Ngày thao tác"
            });

            //Xuất file
            ExportFile(dtData, listColumn, dtHeader, filename, sheetname, comments);
        }
示例#18
0
        public ActionResult Update(BM_Apartment_Receipt obj, string key = "", int page = 1)
        {
            ViewBag.keyValue = key;
            ViewBag.PN       = page;

            //Kiểm tra
            var oldObj = _BM_Apartment_ReceiptService.GetById(obj.Id);

            if (oldObj == null)
            {
                ViewBag.Error = "Bản ghi không tồn tại";
                return(View(obj));
            }

            if (!ModelState.IsValid)
            {
                return(View(oldObj));
            }

            //Gán giá trị
            oldObj.Code          = obj.Code;
            oldObj.Title         = obj.Title;
            oldObj.Description   = obj.Description;
            oldObj.UserCreatedId = obj.UserCreatedId;
            oldObj.DatePaid      = obj.DatePaid;
            oldObj.ApartmentId   = obj.ApartmentId;
            oldObj.ResidentId    = obj.ResidentId;
            oldObj.PayerName     = obj.PayerName;
            oldObj.PayerMobile   = obj.PayerMobile;
            oldObj.UserId        = obj.UserId;
            oldObj.Money         = obj.Money;
            oldObj.PayType       = obj.PayType;
            oldObj.Type          = obj.Type;
            oldObj.Status        = obj.Status;
            oldObj.Note          = obj.Note;

            //Thực hiện cập nhật
            var result = _BM_Apartment_ReceiptService.Update(oldObj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.Id.ToString(), obj.Code, "BM_Apartment_Receipt", ConstField.ResidentCode, ActionConfigO.Update);

                return(RedirectToAction("Index", new { page = page, key = key }));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(oldObj));
            }
        }
示例#19
0
        public ActionResult Update(tblLocker obj, string TypeSelect)
        {
            ViewBag.urlValue    = url ?? Request.Url.PathAndQuery;
            ViewBag.Controllers = GetControllerList();

            if (!ModelState.IsValid)
            {
                return(View(obj));
            }

            var existed = _tblLockerService.GetByName_Id(obj.Name, obj.Id);

            if (existed != null)
            {
                ModelState.AddModelError("Name", "Tên tủ đồ đã bị trùng");
                return(View(obj));
            }

            var existedIndex = _tblLockerService.GetByControllerID_ReaderIndex_Id(obj.ControllerID, obj.ReaderIndex, obj.Id);

            if (existedIndex != null)
            {
                ModelState.AddModelError("ReaderIndex", "Tên tủ đồ đang để trùng địa chỉ reader");
                return(View(obj));
            }

            var oldobj = _tblLockerService.GetById(obj.Id);

            if (oldobj == null)
            {
                return(View(obj));
            }

            oldobj.Name         = obj.Name;
            oldobj.ControllerID = obj.ControllerID;
            oldobj.ReaderIndex  = obj.ReaderIndex;

            var report = _tblLockerService.Update(oldobj);

            if (report.isSuccess)
            {
                WriteLog.Write(report, GetCurrentUser.GetUser(), oldobj.Id.ToString(), oldobj.Name, "tblLocker", ConstField.LockerCode, ActionConfigO.Update);

                return(Redirect(url));
            }
            else
            {
                ModelState.AddModelError("", "Tạo dữ liệu không thành công. Hãy kiểm tra lại dữ liệu nhập vào");
                return(View(obj));
            }
        }
        /// <summary>
        /// thực hiện gia hạn
        /// </summary>
        /// <param name="list"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        MessageReport Extend(List <string> list, ActiveCardCustomViewModel obj)
        {
            bool isSuccess  = false;
            var  dateextend = Convert.ToDateTime(obj.DateExtend).ToString("MM/dd/yyyy");
            var  user       = GetCurrentUser.GetUser().Id;
            var  host       = Request.Url.Host;
            int  money      = 0;
            var  result1    = new MessageReport(false, FunctionHelper.GetLocalizeDictionary("Home", "notification")["updateFailed"]);

            if (list != null && list.Any())
            {
                var count = 0;

                //thêm gia hạn từng thẻ
                foreach (var item in list)
                {
                    var subid      = Guid.NewGuid().ToString();
                    var cardnumber = string.Format("'{0}'", item);
                    count++;

                    //chi tiết từng tháng của thẻ
                    if (!string.IsNullOrEmpty(obj.Json))
                    {
                        var datas = JsonConvert.DeserializeObject <List <ExtendModel> >(obj.Json);

                        if (datas != null && datas.Count > 0)
                        {
                            foreach (var itemM in datas)
                            {
                                //tổng tiền
                                money += itemM.Money;

                                //thêm từng tháng
                                _ExtendCardService.AddNew(cardnumber, itemM.Money, itemM.OldDate, itemM.NewDate, itemM.Date, user, obj.isAllowNegativeDays, subid, Guid.NewGuid().ToString(), dateextend);
                            }
                        }
                    }

                    isSuccess = _tblCardService.AddCardExpireByListCardNumber_V2(cardnumber, money, dateextend, user, obj.isAllowNegativeDays, false, "", subid);

                    money = 0;
                }
            }

            if (isSuccess)
            {
                result1 = new MessageReport(true, FunctionHelper.GetLocalizeDictionary("Home", "notification")["updateSuccess"]);
            }

            return(result1);
        }
示例#21
0
        public JsonSonuc projeYuzdesiDuzenle(int proje_id)
        {
            try
            {
                LoggedUserModel    lgm            = GetCurrentUser.GetUser();
                vrlfgysdbEntities  db             = new vrlfgysdbEntities();
                proje_surec        prj            = db.proje_surec.Where(e => e.id == proje_id).FirstOrDefault();
                List <gorev_proje> projeGorevList = db.gorev_proje.Where(e => e.proje_id == proje_id && e.flag == durumlar.aktif).ToList();

                int toplam        = 0;
                int aktifGorevler = 0;
                foreach (gorev_proje pg in projeGorevList)
                {
                    if (pg.gorevler.flag == durumlar.aktif)
                    {
                        toplam += pg.gorevler.yuzde;
                        aktifGorevler++;
                    }
                }

                if (aktifGorevler != 0)
                {
                    prj.yuzde = toplam / aktifGorevler;
                }
                else
                {
                    prj.yuzde = toplam;
                }

                prj.durum = TamamlamaDurumlari.basladi;

                db.Entry(prj).State = EntityState.Modified;
                db.SaveChanges();

                if (prj.yuzde == 100)
                {
                    List <kullanicilar> yetkiliList = db.kullanicilar.Where(e => e.flag == durumlar.aktif && e.firma_id == lgm.firma_id && e.kullanici_turu <= KullaniciTurleri.firma_yetkili).ToList();
                    foreach (kullanicilar usr in yetkiliList)
                    {
                        bildirimIslemleri.yeniBildirim(usr.id, BildirimTurleri.proje, prj.id, "", prj.isim + " isimli proje tamamlandı ve onayınızı bekliyor.");
                    }
                }

                return(JsonSonuc.sonucUret(true, prj.yuzde));
            }
            catch (Exception e)
            {
                return(JsonSonuc.sonucUret(false, "Proje yüzdesini düzenlerken bir hata oluştu."));
            }
        }
示例#22
0
        public async Task <Result <UserDto> > Handle(GetCurrentUser request, CancellationToken cancellationToken)
        {
            var openIdKey = await _currentUser.GetOpenIdKey();

            if (openIdKey.IsSuccess)
            {
                var result = await _userRepository.GetAsync(openIdKey.Value);

                var user = _mapper.Map <UserDto>(result);
                return(Result <UserDto> .Success(user));
            }

            return(Result <UserDto> .Error(openIdKey.Errors.FirstOrDefault()));
        }
        public JsonResult Delete(string id)
        {
            var result = _SelfHostConfigService.DeleteById(id);

            if (result.isSuccess)
            {
                var cuuser = GetCurrentUser.GetUser();

                //Log for hệ thống
                WriteLog.Write(result, cuuser, id, id, "SelfHostConfig", ConstField.AccessControlCode, ActionConfigO.Delete);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        private void ReportCardExpireFormatCell(DataTable dtData, string filename = "", string sheetname = "", string comments = "", string titleSheet = "", string titleTime = "")
        {
            //Nội dung đầu trang
            var user = GetCurrentUser.GetUser();

            //var timeSearch = "Từ " + titleTime.Split(new[] { '-' })[0] + " đến " + titleTime.Split(new[] { '-' })[1];
            var timeSearch = "Đến " + titleTime;

            var dtHeader = _tblSystemConfigService.getHeaderExcel(titleSheet, timeSearch, user.Username);

            //Header
            var listColumn = new List <SelectListModel>();

            listColumn.Add(new SelectListModel {
                ItemText = "STT", ItemValue = "STT"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "CardNo", ItemValue = "Số thẻ"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Mã thẻ", ItemValue = "Mã thẻ"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Nhóm thẻ", ItemValue = "Nhóm thẻ"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Biển số", ItemValue = "Biển số"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Ngày hết hạn", ItemValue = "Ngày hết hạn"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Khách hàng", ItemValue = "Khách hàng"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Địa chỉ", ItemValue = "Địa chỉ"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Nhóm khách hàng", ItemValue = "Nhóm khách hàng"
            });
            listColumn.Add(new SelectListModel {
                ItemText = "Trạng thái", ItemValue = "Trạng thái"
            });

            //Chuyển dữ liệu về datatable
            // DataTable dt = listData.ToDataTableNullable();

            //Xuất file
            ExportFile(dtData, listColumn, dtHeader, filename, sheetname, comments);
        }
        public ActionResult Create(tblGate obj, bool SaveAndCountinue = false, string group = "", string key = "")
        {
            ViewBag.groupValue = group;
            ViewBag.keyValue   = key;

            //Kiểm tra
            if (!ModelState.IsValid)
            {
                return(View(obj));
            }

            //
            if (string.IsNullOrWhiteSpace(obj.GateName))
            {
                ModelState.AddModelError("GateName", FunctionHelper.GetLocalizeDictionary("Home", "notification")["enter_name"]);
                return(View(obj));
            }

            //
            var objExisted = _tblGateService.GetByName(obj.GateName);

            if (objExisted != null)
            {
                ViewBag.Error = FunctionHelper.GetLocalizeDictionary("Home", "notification")["record_does_not_exist"];;
                return(View(obj));
            }

            //Gán giá trị
            obj.GateID = Guid.NewGuid();

            //Thực hiện thêm mới
            var result = _tblGateService.Create(obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.GateID.ToString(), obj.GateName, "tblGate", ConstField.ParkingCode, ActionConfigO.Create);

                if (SaveAndCountinue)
                {
                    TempData["Success"] = result.Message;
                    return(RedirectToAction("Create", new { group = group, key = key, selectedId = obj.GateID }));
                }

                return(RedirectToAction("Index", new { group = group, key = key, selectedId = obj.GateID }));
            }
            else
            {
                return(View(obj));
            }
        }
示例#26
0
        public ActionResult Update(tblVehicleGroup obj, int page = 1, string group = "")
        {
            ViewBag.VehicleTypes = GetListVehicleType();
            ViewBag.Group        = group;
            ViewBag.PN           = page;

            //Kiểm tra
            var oldObj = _tblVehicleGroupService.GetById(obj.VehicleGroupID);

            if (oldObj == null)
            {
                ViewBag.Error = "Bản ghi không tồn tại";
                return(View(obj));
            }

            if (!ModelState.IsValid)
            {
                return(View(obj));
            }

            if (string.IsNullOrWhiteSpace(obj.VehicleGroupName))
            {
                ModelState.AddModelError("VehicleGroupName", "Vui lòng nhập tên nhóm xe");
                return(View(oldObj));
            }

            //Gán giá trị
            oldObj.VehicleGroupCode = obj.VehicleGroupCode;
            oldObj.Inactive         = obj.Inactive;
            oldObj.LimitNumber      = obj.LimitNumber;
            oldObj.VehicleGroupName = obj.VehicleGroupName;
            oldObj.SortOrder        = obj.SortOrder;
            oldObj.VehicleType      = obj.VehicleType;

            //Thực hiện thêm mới
            var result = _tblVehicleGroupService.Update(oldObj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.VehicleGroupID.ToString(), obj.VehicleGroupName, "tblVehicleGroup", ConstField.ParkingCode, ActionConfigO.Update);

                return(RedirectToAction("Index", new { page = page }));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(oldObj));
            }
        }
        public ActionResult Update(BM_Resident obj, string key = "", string residentGroupIdSearch = "", int page = 1, string ResidentGroup = "")
        {
            ViewBag.keyValue             = key;
            ViewBag.residentGroupIdValue = residentGroupIdSearch;
            ViewBag.PN = page;

            ViewBag.CustomerGroups = GetMenuList();
            // ViewBag.ControllerList = _tblAccessControllerService.GetAllActive();
            //ViewBag.LevelList = _tblAccessLevelService.GetAllActive();

            //Kiểm tra
            var oldObj = _BM_ResidentService.GetById(obj.Id);

            if (oldObj == null)
            {
                ViewBag.Error = "Bản ghi không tồn tại";
                return(View(obj));
            }

            if (!ModelState.IsValid)
            {
                return(View(oldObj));
            }

            //Gán giá trị
            oldObj.Name            = obj.Name;
            oldObj.Mobile          = obj.Mobile;
            oldObj.Email           = obj.Email;
            oldObj.CustomerId      = obj.CustomerId;
            oldObj.ResidentGroupId = ResidentGroup;
            oldObj.Note            = obj.Note;
            oldObj.Description     = obj.Description;
            oldObj.Description     = obj.Description;

            //Thực hiện cập nhật
            var result = _BM_ResidentService.Update(oldObj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.Id.ToString(), obj.Name, "BM_Resident", ConstField.ResidentCode, ActionConfigO.Update);

                return(RedirectToAction("Index", new { page = page, key = key, residentGroupId = residentGroupIdSearch, selectedId = oldObj.Id }));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(oldObj));
            }
        }
示例#28
0
        public ActionResult Update(tblLockerLine obj)
        {
            ViewBag.urlValue = url ?? Request.Url.PathAndQuery;

            //Danh sách sử dụng
            ViewBag.PCs            = GetPCList();
            ViewBag.Communications = GetCommunicationList();
            ViewBag.LineTypes      = GetLineList();

            //Kiểm tra
            var oldObj = _tblLockerLineService.GetById(obj.Id);

            if (oldObj == null)
            {
                ViewBag.Error = "Bản ghi không tồn tại";
                return(View(obj));
            }

            if (!ModelState.IsValid)
            {
                return(View(oldObj));
            }

            //Gán giá trị
            oldObj.DownloadTime      = obj.DownloadTime;
            oldObj.Baudrate          = obj.Baudrate;
            oldObj.CommunicationType = obj.CommunicationType;
            oldObj.Comport           = obj.Comport;
            oldObj.Active            = obj.Active;
            oldObj.LineTypeID        = obj.LineTypeID;
            oldObj.PCID       = obj.PCID;
            oldObj.LineTypeID = obj.LineTypeID;
            oldObj.LineName   = obj.LineName;

            //Thực hiện cập nhật
            var result = _tblLockerLineService.Update(oldObj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), oldObj.Id.ToString(), oldObj.LineName, "tblLockerLine", ConstField.LockerCode, ActionConfigO.Update);

                return(Redirect(url));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(oldObj));
            }
        }
示例#29
0
        public ActionResult Update(tblFtpAccount obj, int page = 1, string group = "", string key = "")
        {
            //
            ViewBag.PN         = page;
            ViewBag.groupValue = group;
            ViewBag.keyValue   = key;

            //Kiểm tra
            var oldObj = _tblFtpAccountService.GetById(obj.Id);

            if (oldObj == null)
            {
                ViewBag.Error = FunctionHelper.GetLocalizeDictionary("Home", "notification")["record_does_not_exist"];
                return(View(obj));
            }

            //
            if (string.IsNullOrWhiteSpace(obj.FtpHost))
            {
                ModelState.AddModelError("FtpHost", FunctionHelper.GetLocalizeDictionary("Home", "notification")["enter_name"]);
                return(View(oldObj));
            }

            if (!ModelState.IsValid)
            {
                return(View(oldObj));
            }

            oldObj.FtpHost = obj.FtpHost;
            oldObj.FtpPass = obj.FtpPass;
            oldObj.FtpUser = obj.FtpUser;
            oldObj.FtpPass = CryptoProvider.SimpleEncryptWithPassword(obj.FtpPass, SecurityModel.Session_Key);
            //oldObj.SortOrder = obj.SortOrder;

            //Thực hiện cập nhật
            var result = _tblFtpAccountService.Update(oldObj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.Id, obj.FtpHost, "tblFtpAccount", ConstField.ParkingCode, ActionConfigO.Update);

                return(RedirectToAction("Index", new { group = group, key = key, page = page, selectedId = obj.Id }));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(oldObj));
            }
        }
示例#30
0
        public ServiceResponse GetStepExecution(int processExeId)
        {
            ServiceResponse result = new ServiceResponse();

            try
            {
                var currentUserID = GetCurrentUser.GetUserID(User.Claims.ToList());
                result = _processExeService.GetStepExecution(processExeId, currentUserID);
            }
            catch (Exception ex)
            {
                result.OnExeption(ex);
            }

            return(result);
        }