예제 #1
0
        public void GetExtrapolatedValuesPeriodicDateTime()
        {
            var function = FunctionHelper.Get1DFunction <DateTime, double>();
            //3 days
            var times = new[] { 1, 2, 3 }.Select(i => new DateTime(2000, 1, i));

            function.SetComponentArgumentValues(new[] { 0.0, 1.0, 2.0 }, times);

            //Extrapolate periodic
            IVariable x = function.Arguments[0];

            x.ExtrapolationType = ExtrapolationType.Periodic;

            //Day number 4 should equal number 1
            var dayFour = new DateTime(2000, 1, 4);

            Assert.AreEqual(1.0d, function.Evaluate <double>(new VariableValueFilter <DateTime>(x, dayFour)));
        }
        private void ExportFileBVDK_ReportTotalMoneyByCardGroup(DataTable list = null, List <SelectListModel> listTitle = null, DataTable dtHeader = null, string filename = "", string sheetname = "", string comments = "")
        {
            // Gọi lại hàm để tạo file excel
            var stream = FunctionHelper.WriteToExcelBVDK_ReportTotalMoneyByCardGroup(null, list, listTitle, dtHeader, sheetname, comments);
            // Tạo buffer memory strean để hứng file excel
            var buffer = stream as MemoryStream;

            // Đây là content Type dành cho file excel, còn rất nhiều content-type khác nhưng cái này mình thấy okay nhất
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            // Dòng này rất quan trọng, vì chạy trên firefox hay IE thì dòng này sẽ hiện Save As dialog cho người dùng chọn thư mục để lưu
            // File name của Excel này là ExcelDemo
            Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}-{1}.xlsx", filename, DateTime.Now.ToString("yyyyMMdd")));
            // Lưu file excel của chúng ta như 1 mảng byte để trả về response
            Response.BinaryWrite(buffer.ToArray());
            // Send tất cả ouput bytes về phía clients
            Response.Flush();
            Response.End();
        }
예제 #3
0
        public void GetExtrapolatedValuesLinear1D()
        {
            var function = FunctionHelper.Get1DFunction <double, double>();

            // set (fx, fy) values to (100.0, 200.0) for a combination of x and y values.
            function.SetComponentArgumentValues(
                new[] { 100.0, 200.0, 300.0 },
                new[] { 1.0, 2.0, 3.0 });

            //Extrapolate linear
            function.Arguments[0].ExtrapolationType = ExtrapolationType.Linear;

            //before the 1st argument value
            Assert.AreEqual(50, function.Evaluate1D <double, double>(0.5));

            //after the las
            Assert.AreEqual(350, function.Evaluate1D <double, double>(3.5));
        }
예제 #4
0
        public JsonResult GetResolution(string key)
        {
            var listCus = new List <string>();

            var list = FunctionHelper.Resolution();

            list = list.Where(n => n.Text.Contains(key)).ToList();

            if (list.Any())
            {
                foreach (var item in list)
                {
                    listCus.Add(item.Text);
                }
            }

            return(Json(listCus, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public ActionResult Index(string key, string pc, int page = 1, string group = "", string selectedId = "")
        {
            var pageSize = 20;

            var list = _tblLaneService.GetAllCustomPagingByFirst(key, pc, page, pageSize);

            var gridModel = PageModelCustom <tblLane> .GetPage(list, page, pageSize);

            ViewBag.PCs       = GetPCList();
            ViewBag.LaneTypes = FunctionHelper.LaneTypes1();

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

            return(View(gridModel));
        }
예제 #6
0
        public void InterpolateConstant1D()
        {
            var function = FunctionHelper.Get1DFunction <double, double>();

            var xValues = new[] { 1.0, 2.0, 3.0 };
            var yValues = new[] { 100.0, 200.0, 300.0 };

            function.SetComponentArgumentValues(yValues, xValues);

            function.Arguments[0].InterpolationType = InterpolationType.Constant;

            var value = function.Evaluate1D <double, double>(1.5);

            Assert.AreEqual(100.0, value);

            value = function.Evaluate1D <double, double>(2.5);
            Assert.AreEqual(200.0, value);
        }
예제 #7
0
        /// <summary>
        /// 关注职业路径
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="firstId">一级职业路径ID</param>
        /// <returns></returns>
        public RetJsonModel FollowCareerPath(string userId, string firstId)
        {
            var db = DBContext.GetInstance;

            try
            {
                DateTime now       = db.GetDate();
                int      timestamp = FunctionHelper.GetTimestamp();

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = timestamp;

                var ucData = db.Queryable <MAP_USER_CARREERPATH>()
                             .Where(x => x.USER_ID == userId && x.CP_FIRST_ID == firstId && x.STATE == "A")
                             .First();
                if (ucData == null)
                {
                    MAP_USER_CARREERPATH mapModel = new MAP_USER_CARREERPATH();
                    mapModel.ID = Guid.NewGuid().ToString();
                    mapModel.DATETIME_CREATED = now;
                    mapModel.STATE            = "A";
                    mapModel.USER_ID          = userId;
                    mapModel.CP_FIRST_ID      = firstId;
                    mapModel.TIMESTAMP_INT    = timestamp;
                    db.Insertable(mapModel).ExecuteCommand();

                    jsonModel.status = 1;
                    jsonModel.msg    = "关注成功";
                }
                else
                {
                    db.Deleteable <MAP_USER_CARREERPATH>().Where(x => x.ID == ucData.ID).ExecuteCommand();

                    jsonModel.status = 1;
                    jsonModel.msg    = "取关成功";
                }

                return(jsonModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void btnControl_btnEventPrint_Click(object sender, EventArgs e)
        {
            string str;

            //if (chkAll.Checked)
            //    str = "SELECT sp.*, dvt.TEN DVT_TEN, gt.TEN GOITHAU_TEN FROM DM_SANPHAM sp "
            //        + " LEFT JOIN dbo.DM_GOITHAU gt ON gt.GOITHAU_ID = sp.SP_GOITHAU "
            //        + " LEFT JOIN dbo.DM_DVT dvt ON dvt.DVT_ID=sp.DVT_ID "
            //        + " WHERE isnull(gt.DELETED,0)=0 "
            //        + " and DOT_MA='" + clsParameter._dotMaDauThau + "'";
            //else
            str = "SELECT sp.*, dvt.TEN DVT_TEN, gt.TEN GOITHAU_TEN, sx.TEN NUOCSX_TEN FROM DM_SANPHAM sp "
                  + " LEFT JOIN DM_GOITHAU gt ON gt.GOITHAU_ID = sp.SP_GOITHAU "
                  + " LEFT JOIN DM_NUOCSX sx ON sx.NUOCSX_ID = sp.SP_NUOCSX_ID "
                  + " LEFT JOIN DM_DVT dvt ON dvt.DVT_ID=sp.DVT_ID "
                  + " WHERE isnull(gt.DELETED,0)=0 "
                  + " and DOT_MA='" + clsParameter._dotMaDauThau + "'"
                  + " and gt.GOITHAU_ID = " + clsChangeType.change_int(lueGoiThauFilter.EditValue)
                  + " order by sp.SP_MA asc";
            DataTable dt = new DataTable();

            da.SelectCommand = new SqlCommand(str, clsConnection._conn);
            da.Fill(dt);
            XtraReport _rpt = new XtraReport();

            if (FunctionHelper.LaGoiVTYT(Convert.ToInt64(lueGoiThauFilter.EditValue)))
            {
                rptDsSanPham_VTYT rpt = new rptDsSanPham_VTYT();
                rpt.DataSource = dt;
                rpt.DataMember = "SANPHAM";
                _rpt           = rpt;
            }
            else
            {
                rptDsSanPham rpt = new rptDsSanPham();
                rpt.DataSource = dt;
                rpt.DataMember = "SANPHAM";
                _rpt           = rpt;
            }

            frmPrint f = new frmPrint(_rpt);

            f.ShowDialog();
        }
        public ActionResult Create(tblBlackList 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.IsNullOrEmpty(obj.Plate) || String.IsNullOrWhiteSpace(obj.Plate))
            {
                ViewBag.Error = FunctionHelper.GetLocalizeDictionary("Home", "notification")["enter_Number_plate"];
                return(View(obj));
            }

            var objExisted = _tblBlackListService.GetByName_Plate(obj.Name, obj.Plate);

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

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

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.Id.ToString(), obj.Plate, "tblBlackList", ConstField.ParkingCode, ActionConfigO.Create);

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

                return(RedirectToAction("Index", new { group = group, key = key, selectedId = obj.Id }));
            }
            else
            {
                return(View(obj));
            }
        }
예제 #10
0
        public static async Task <IActionResult> Get(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = Constants.Routes.LogEntries + "/{key}")] HttpRequest req,
            string key,
            ILogger log)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                return(new BadRequestResult());
            }

            var result = await EntityManager.Get <LogEntry>(Configurations.StorageConnectionString).GetAsync(key);

            if (result == null)
            {
                return(new NotFoundResult());
            }

            return(new OkObjectResult(FunctionHelper.ToJson(result)));
        }
예제 #11
0
        /// <summary>
        /// 收到Lot设备同步订阅
        /// </summary>
        public static void GetLotDeviceChangeQueue()
        {
            Task.Run(() =>
            {
                ToolHelper.FunctionHelper.writeLog("主动上报设备改变", "启动线程……", "LotDeviceChangeQueue");
                try
                {
                    using (RedisListService service = new RedisListService())
                    {
                        service.Subscribe("LotDeviceChangeQueue", (c, Account, iRedisSubscription) =>
                        {
                            //ToolHelper.FunctionHelper.writeLog("设备同步订阅", Account, "LotDeviceChangeQueue");
                            using (RedisHashService serviceHash = new RedisHashService())
                            {
                                //获取openUid
                                string openUid = serviceHash.GetValueFromHash("DuerOSOpenUid_Host", Account);
                                if (!string.IsNullOrEmpty(openUid))
                                {
                                    var tempPostModel = new DuerOSSyncDevice()
                                    {
                                        botId    = DuerOSSyncBotId,
                                        logId    = FunctionHelper.GetTimStamp() + Account,
                                        openUids = new List <string> {
                                            openUid
                                        }
                                    };

                                    var tempRes = ToolHelper.FunctionHelper.PostJsonString(DuerOSSyncUrl, JsonConvert.SerializeObject(tempPostModel));//{"status":21093,"msg":"Appliance specificed not exist, stop sync","messageId":"1557135094549","data":{"updated_attribute_num":0}}
                                    //{"status":0,"msg":"ok","logid":"1557387335989AAA","data":{"discover":"succeed","failed":[],"succeed":["ee65663a03e810214acc0ac1c18260e7"]}}
                                    ToolHelper.FunctionHelper.writeLog("主动上报设备改变: " + Account, tempRes, "LotDeviceChangeQueue");
                                    Thread.Sleep(100);
                                }
                            }
                        });
                    }
                }
                catch (Exception ex)
                {
                    FunctionHelper.writeLog("设备同步订阅异常", ex.Message, "LotDeviceChangeQueue");
                    throw;
                }
            });
        }
        public ProfileVacationDTO[] GetUserVacationsData(string id)
        {
            var employee         = _employees.GetById(id);
            var vacationStatuses = _vacationStatusTypes.Get();
            var vacationTypes    = _vacationTypes.Get();

            var vacations = _vacations.Get(x => x.EmployeeID.Equals(employee.EmployeeID)).Select(x => new ProfileVacationDTO
            {
                VacationType = vacationTypes.FirstOrDefault(y => y.VacationTypeID.Equals(x.VacationTypeID)).VacationTypeName,
                Comment      = x.Comment,
                DateOfBegin  = x.DateOfBegin,
                DateOfEnd    = x.DateOfEnd,
                Duration     = x.Duration,
                Status       = vacationStatuses.FirstOrDefault(y => y.VacationStatusTypeID.Equals(x.VacationStatusTypeID)).VacationStatusName,
                Created      = x.Created
            }).OrderBy(x => FunctionHelper.VacationSortFunc(x.Status)).ThenBy(x => x.Created).ToArray();

            return(vacations);
        }
예제 #13
0
        private void btnControl_btnEventView_Click(object sender, EventArgs e)
        {
            if (lueGoiThau.EditValue == null)
            {
                clsMessage.MessageInfo("Vui lòng chọn nhà thầu");
                return;
            }

            WaitDialogForm _wait = new WaitDialogForm("Đang hiển thị dữ liệu ...", "Vui lòng đợi giây lát");

            rpt = new rptDanhGiaChiTietHoSoDuThau();
            rpt.pHospital.Value       = clsParameter.pHospital;
            rpt.pParentHospital.Value = clsParameter.pParentHospital;
            rpt.pNgayMoThau.Value     = clsParameter.pNgayMoThau;

            rpt.pQuyetDinh.Value   = clsParameter.pQuyetDinh;
            rpt.pTitleFooter.Value = ReportHelper.getTitleFooter(LoaiBaoCao.BM03);
            rpt.pValueFooter.Value = ReportHelper.getValueFooter(LoaiBaoCao.BM03);

            DataSet ds = new DataSet();

            ds = FunctionHelper.HoSoDauThau(Convert.ToInt32(lueGoiThau.EditValue));
            DataView dv = ds.Tables[0].DefaultView;

            dv.RowFilter   = "TT=True or (GIA_CHAOTHAU_FINAL=MIN_GIA_CHAOTHAU)";
            dv.Sort        = "SP_MA asc";
            rpt.DataSource = dv; // dsDanhGiaHoSoDuThau1.ChiTietHoSo;

            rpt.txtDiemTH.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
                new DevExpress.XtraReports.UI.XRBinding("Text", null, "ChiTietHoSo.DiemTH", "{0:" + clsParameter.pFormatNumber + "}")
            });

            rpt.txtDiemTC.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
                new DevExpress.XtraReports.UI.XRBinding("Text", null, "ChiTietHoSo.DiemTC", "{0:" + clsParameter.pFormatNumber + "}")
            });

            rpt.DataMember               = "ChiTietHoSo";
            rpt.pGoiThau.Value           = lueGoiThau.Text;
            printControl1.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument(true);
            btnControl.btnPrint.Enabled = true;
            _wait.Close();
        }
예제 #14
0
        public void GetExtrapolatedValuesPeriodicDateNotRegulair()
        {
            var function = FunctionHelper.Get1DFunction <DateTime, double>();
            //3 days
            var times = new[] { 1, 2, 3, 30 }.Select(i => new DateTime(2000, 1, i));

            function.SetComponentArgumentValues(new[] { 0.0, 1.0, 2.0, 2.0 }, times);

            //Extrapolate periodic
            IVariable x = function.Arguments[0];

            x.InterpolationType = InterpolationType.Linear;
            x.ExtrapolationType = ExtrapolationType.Periodic;

            //Day number 10 of February
            var dayTenOfFebruary = new DateTime(2000, 2, 10);

            Assert.AreEqual(2.0d, function.Evaluate <double>(new VariableValueFilter <DateTime>(x, dayTenOfFebruary)));
        }
예제 #15
0
        public void GetInterpolatedValueBetweenTwoPeriodsOfDateTimeExtrapolatedValuesPeriodic()
        {
            var function = FunctionHelper.Get1DFunction <DateTime, double>();
            //3 days
            var times = new[] { 1, 2, 3 }.Select(i => new DateTime(2000, 1, i));

            function.SetComponentArgumentValues(new[] { 5.0, 3.0, 1.0 }, times);

            //Extrapolate periodic
            IVariable x = function.Arguments[0];

            x.InterpolationType = InterpolationType.Linear;
            x.ExtrapolationType = ExtrapolationType.Periodic;

            //Day number 3.5 should equal number 4 (linear interpolation 5 and 3)
            var dayThreeAndAHalf = new DateTime(2000, 1, 3, 12, 0, 0, 0);

            Assert.AreEqual(4.0d, function.Evaluate <double>(new VariableValueFilter <DateTime>(x, dayThreeAndAHalf)));
        }
예제 #16
0
        public void GetExtrapolatedValuesPeriodicDateTimeJustAfterTheFirstPeriod()
        {
            var function = FunctionHelper.Get1DFunction <DateTime, double>();
            //3 days
            var times = new[] { 1, 2, 3 }.Select(i => new DateTime(2000, 1, i));

            function.SetComponentArgumentValues(new[] { 0.0, 1.0, 2.0 }, times);

            //Extrapolate periodic
            IVariable x = function.Arguments[0];

            x.InterpolationType = InterpolationType.Linear;
            x.ExtrapolationType = ExtrapolationType.Periodic;

            //Day number 3 and one second should be close to 0.0
            var dayThreeAndOneSecond = new DateTime(2000, 1, 3, 0, 0, 1);

            Assert.Less(function.Evaluate <double>(new VariableValueFilter <DateTime>(x, dayThreeAndOneSecond)), 0.1d);
        }
예제 #17
0
        public ActionResult Update(MenuFunction obj, string group = "")
        {
            //ViewBag
            ViewBag.IconList    = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml");
            ViewBag.DDLMenuType = FunctionHelper.MenuType();

            ViewBag.GroupID = group;

            if (String.IsNullOrEmpty(obj.MenuName) || String.IsNullOrWhiteSpace(obj.MenuName))
            {
                ModelState.AddModelError("", FunctionHelper.GetLocalizeDictionary("Home", "notification")["menu_Name"]);
                ViewBag.DDLMenu     = GetMenuList();
                ViewBag.IconList    = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml");
                ViewBag.DDLMenuType = FunctionHelper.MenuType();
                ViewBag.GroupID     = group;
                return(View(obj));
            }

            if (ModelState.IsValid)
            {
                obj.ControllerName = obj.ControllerName != null ? obj.ControllerName : string.Format("controller_{0}", obj.Id);
                obj.ActionName     = obj.ActionName != null ? obj.ActionName : string.Format("action_{0}", obj.Id);
                obj.Url            = string.Format("/{0}/{1}", obj.ControllerName, obj.ActionName);

                bool isSuccess = _MenuFunctionService.Update(obj);
                ViewBag.DDLMenu = GetMenuList();

                if (isSuccess)
                {
                    CacheLayer.ClearAll();
                    MessageReport report = new MessageReport(true, FunctionHelper.GetLocalizeDictionary("Home", "notification")["updateSuccess"]);
                    WriteLog.Write(report, GetCurrentUser.GetUser(), obj.Id, obj.MenuName, "MenuFunction");

                    return(RedirectToAction("Index", new { group = group }));
                }
                else
                {
                    ModelState.AddModelError("", FunctionHelper.GetLocalizeDictionary("Home", "notification")["ErMenu"]);
                    return(View(obj));
                }
            }
            return(View());
        }
예제 #18
0
        void CreateColumn()
        {
            dsSanPhamTheoCty1 = new DataSets.dsSanPhamTheoCty();
            //dsSanPhamTheoCty1.DsSanPhamTheoCty.Clear();
            ////Clear all column exits
            //for (int i = 0; i < dtCol.Rows.Count; i++)
            //{
            //    dsSanPhamTheoCty1.DsSanPhamTheoCty.Columns.Remove(dtCol.Rows[i][0].ToString());
            //}

            dtCol = new DataTable();
            string str = "SELECT DISTINCT VIET_TAT ,SORT_NHOM, DIEM_CHUAN FROM dbo.DM_GOITHAU_KYTHUAT a "
                         + " LEFT JOIN dbo.DM_NHOM_KYTHUAT b ON a.NHOM_KYTHUAT_ID = b.NHOM_KYTHUAT_ID "
                         + " LEFT JOIN dbo.DM_NHOM_KYTHUAT_DIEMCHUAN c ON a.GOITHAU_ID = c.GOITHAU_ID AND a.NHOM_KYTHUAT_ID = c.NHOM_KYTHUAT_ID"
                         + " WHERE a.GOITHAU_ID =" + clsChangeType.change_int64(lueGoiThau.EditValue) + " ORDER BY a.SORT_NHOM";

            dtCol = FunctionHelper.LoadDM(str);
            int k = bandYCKT.Columns.Count;

            //Xóa các cột động trong band
            for (int i = 0; i < k; i++)
            {
                bandYCKT.Columns.Remove(bandYCKT.Columns[0]);
            }

            //Thêm mới.
            for (int i = 0; i < dtCol.Rows.Count; i++)
            {
                //Add Band
                BandedGridColumn col = new BandedGridColumn();
                col.Caption   = string.Format("({0})", i + 1);//dtCol.Rows[i][0] + string.Empty;
                col.Name      = dtCol.Rows[i][0] + string.Empty;
                col.FieldName = dtCol.Rows[i][0] + string.Empty;
                col.OptionsColumn.AllowEdit = false;
                col.Visible = true;
                gvGrid.Columns.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[] { col });
                this.bandYCKT.Columns.Add(col);

                //Add Column Dataset
                dsSanPhamTheoCty1.DsSanPhamTheoCty.Columns.Add(dtCol.Rows[i][0].ToString(), typeof(String));
            }
            bandYCKT.Width = 45 * bandYCKT.Columns.Count;
        }
예제 #19
0
        public RetJsonModel ReadMsg(string userId, List <string> msgIds)
        {
            try
            {
                var          db = DBContext.GetInstance;
                MessageClass MC = new MessageClass();
                MC.UpdateMsg(db, msgIds);

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time   = FunctionHelper.GetTimestamp();
                jsonModel.status = 1;
                jsonModel.msg    = "成功";
                return(jsonModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private IMultiDimensionalArray <T> GetTimeInterpolatedValues <T>(DateTime timeArgumentValue, IVariableFilter[] filters)
        {
            if (Time.InterpolationType == InterpolationType.None)
            {
                throw new ArgumentOutOfRangeException("Interpolation is disabled");
            }

            if (Time.InterpolationType == InterpolationType.Constant)
            {
                //get the nearest t smaller than the t given t;
                var time       = (DateTime)FunctionHelper.GetLastValueSmallerThan(timeArgumentValue, Time.Values);
                var newFilters = (IVariableFilter[])filters.Clone();

                ReplaceTimeFilter(time, newFilters);

                return(base.GetValues <T>(newFilters));
            }
            throw new NotImplementedException();
        }
        public void Seed(IContext context)
        {
            var dict         = new Dictionary <string, List <SecurityFunctionInfo> >();
            var securityInfo = new FunctionHelper(RegisterModuleFunctionContainer.Instance.Container).GetFunctionNames();

            dict.Add("Administrator", securityInfo.ToList());

            foreach (var item in dict)
            {
                var groupName    = item.Key;
                var functionList = item.Value;

                string grpName = groupName;
                var    groupId = from cm in context.EntitySet <UserGroup>()
                                 where cm.Name == grpName
                                 select cm.UserGroupId;

                foreach (var function in functionList)
                {
                    var funcName          = function.FunctionName;
                    var centralFunctionId = from cm in context.EntitySet <CentralFunction>()
                                            where cm.FunctionName == funcName
                                            select cm.CentralFunctionId;

                    if (centralFunctionId.Any())
                    {
                        var record = new UserGroupFunction
                        {
                            /* CentralFunction =  could be a collection; no need to generate this now;;*/
                            /* UserGroup =  could be a collection; no need to generate this now;;*/
                            Note              = string.Format("{0}-{1}", funcName, groupId.First()),
                            Description       = "",
                            CentralFunctionId = centralFunctionId.First(),
                            UserGroupId       = groupId.First(),
                            CreatedBy         = "System",
                        };
                        context.EntitySet <UserGroupFunction>().AddOrUpdate(c => new { c.Note }, record);
                    }
                }
            }

            context.SaveChanges();
        }
예제 #22
0
        private void MenuItem1_Click(object sender, EventArgs e)
        {
            var menuItemName = (sender as ToolStripMenuItem).Name;

            this.Tag = menuItemName;
            var menuItem = _dataList.Find(x => x.Name == menuItemName);

            //var args = new ContextMenuItemClickEventArgs(null, menuItemName, menuItem.Action);
            if (OnMenuItemClick != null)
            {
                CurrentTransaction.Action                = menuItem.Action;
                CurrentTransaction.DisplayName           = FunctionHelper.GetDisplayName(_annexList.Count > 0, "", menuItem.Name, _annexList, menuItem.DisplayName);
                CurrentTransaction.ControlName           = menuItemName;
                CurrentTransaction.ExecModeFlag          = menuItem.ExecModeFlag;
                CurrentTransaction.ShowRunningStatusFlag = menuItem.ShowRunningStatusFlag;
                CurrentTransaction.WriteIntoLogFlag      = menuItem.WriteIntoLogFlag;
                OnMenuItemClick(this, null);
            }
        }
예제 #23
0
 private void searchLookUpEdit1_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
 {
     if (FunctionHelper.GetValue(e.Value).Contains(","))
     {
         e.DisplayText = e.Value.ToString();
     }
     else
     {
         var re = GetLuValues();
         if (re[0].Count == 1)
         {
             e.DisplayText = re[1].First();
         }
         else
         {
             e.DisplayText = "";
         }
     }
 }
예제 #24
0
        public static async Task <IActionResult> RunAsync(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = Constants.Routes.EventConfigs)] HttpRequest req,
            ILogger log,
            CancellationToken cancellationToken)
        {
            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            var    entity      = JsonConvert.DeserializeObject <PseudoEvent>(requestBody);

            if (entity == null)
            {
                return(new BadRequestResult());
            }

            var timestamp = entity.EventTimestamp.AddMinutes(-entity.LeadTimeInMinutes);

            if (timestamp < DateTimeOffset.UtcNow)
            {
                return(new NoContentResult());
            }

            var payload = new EventDispatchTrigger
            {
                DispatchedAt = DateTimeOffset.UtcNow,
                Payload      = entity,
                PayloadType  = nameof(PseudoEvent),
                EntityId     = entity.Id.ToString(),
                EntityTag    = DateTimeOffset.UtcNow.ToString("O") // For Cosmos DB entities this could be the ETag value
            };

            var message = new ServiceBusMessage
            {
                Subject       = nameof(EventDispatchTrigger),
                MessageId     = entity.Id.ToString(),
                Body          = BinaryData.FromObjectAsJson(payload),
                ContentType   = "application/json",
                CorrelationId = Guid.NewGuid().ToString()
            };

            await FunctionHelper.ScheduleTrigger(message, timestamp, log, cancellationToken);

            return(new OkResult());
        }
예제 #25
0
        public ActionResult Create(tblFtpAccount 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.FtpHost))
            {
                ModelState.AddModelError("FtpHost", FunctionHelper.GetLocalizeDictionary("Home", "notification")["enter_name"]);
                return(View(obj));
            }

            //Gán giá trị
            obj.Id      = Common.GenerateId();
            obj.FtpPass = CryptoProvider.SimpleEncryptWithPassword(obj.FtpPass, SecurityModel.Session_Key);

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

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

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

                return(RedirectToAction("Index", new { group = group, key = key, selectedId = obj.Id }));
            }
            else
            {
                return(View(obj));
            }
        }
        public ActionResult Create(MenuFunction obj, bool SaveAndCountinue = false)
        {
            //ViewBag
            ViewBag.DDLMenu     = GetMenuList();
            ViewBag.IconList    = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml");
            ViewBag.DDLMenuType = FunctionHelper.MenuType();

            ViewBag.urlValue = url;

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

            obj.Id             = Common.GenerateId();
            obj.ControllerName = obj.ControllerName != null ? obj.ControllerName : string.Format("controller_{0}", obj.Id);
            obj.ActionName     = obj.ActionName != null ? obj.ActionName : string.Format("action_{0}", obj.Id);
            obj.Url            = string.Format("/{0}/{1}", obj.ControllerName, obj.ActionName);
            obj.IsDeleted      = false;

            var report = _MenuFunctionService.Create(obj);

            if (report.isSuccess)
            {
                //For cache
                CacheLayer.ClearAll();

                if (SaveAndCountinue)
                {
                    TempData["Success"] = report.Message;

                    return(RedirectToAction("Create", "MenuFunction", new { controllername = obj.ControllerName, parentid = obj.ParentId, menytype = obj.MenuType, ordernu = obj.OrderNumber + 1 }));
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Có lỗi xảy ra trong quá trình khởi tạo.");
                return(View(obj));
            }
        }
예제 #27
0
        void BindingData()
        {
            string str = "SELECT a.DAUTHAU_ID, a.SP_MA, VIET_TAT, a.DIEM FROM dbo.DAUTHAU_CT a "
                         + " join DAU_THAU dt on a.DAUTHAU_ID = dt.DAUTHAU_ID "
                         + " JOIN dbo.DM_NHOM_KYTHUAT_CT b ON a.NHOM_KYTHUAT_CT_ID = b.NHOM_KYTHUAT_CT_ID "
                         + " JOIN dbo.DM_GOITHAU_KYTHUAT c ON b.NHOM_KYTHUAT_CT_ID = c.NHOM_KYTHUAT_CT_ID AND a.GOITHAU_ID = c.GOITHAU_ID "
                         + " JOIN dbo.DM_NHOM_KYTHUAT d ON d.NHOM_KYTHUAT_ID = c.NHOM_KYTHUAT_ID "
                         + " WHERE a.CTY_MA = '" + (lueCongTy.EditValue + string.Empty) + "' AND a.GOITHAU_ID =" + clsChangeType.change_int64(lueGoiThau.EditValue);

            if (chkDiemKT_Dat.Checked)
            {
                DataTable dt = FunctionHelper.LoadDM("select * from DM_GOITHAU where GOITHAU_ID = " + clsChangeType.change_int64(lueGoiThau.EditValue));
                if (dt.Rows.Count > 0)
                {
                    str += " AND isnull(dt.LOAI_PL, 0) = 0 AND ISNULL(dt.SP_DIEM_BTC,dt.TONG_DIEM_KT) >=" + dt.Rows[0]["DIEMKT"];
                }
            }

            str += " ORDER BY a.SP_MA,c.SORT_NHOM";

            SqlDataAdapter d = new SqlDataAdapter(str, clsConnection._conn);
            DataTable      t = new DataTable();

            d.Fill(t);

            for (int i = 0; i < dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows.Count; i++)
            {
                int       TongDiemKT = 0;
                DataRow[] r          = t.Select(string.Format("SP_MA='{0}' and DAUTHAU_ID ={1}", dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i]["SP_MA"].ToString(), dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i]["DAUTHAU_ID"].ToString()));
                foreach (DataRow item in r)
                {
                    dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i][item["VIET_TAT"].ToString()] = item["DIEM"].ToString();
                    TongDiemKT = TongDiemKT + clsChangeType.change_int(item["DIEM"]);
                }

                //Cập nhật tổng điểm
                dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i]["TONG_DIEM_KT"] = TongDiemKT;

                //Nếu Có điểm của BTC thì in điểm BTC ngược lại lấy tổng điểm.
                dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i]["SP_TONGDIEM_PRINT"] = clsChangeType.change_int(dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i]["SP_DIEM_BTC"]) > 0 ? dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i]["SP_DIEM_BTC"] : dsSanPhamTheoCty1.DsSanPhamTheoCty.Rows[i]["TONG_DIEM_KT"];
            }
        }
예제 #28
0
        /// <summary>
        /// 获取当前用户的通知详情
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="cursor"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public RetJsonModel GetMessageInfo(string userId, int cursor, int count)
        {
            try
            {
                var          db   = DBContext.GetInstance;
                MessageClass MC   = new MessageClass();
                dynamic      data = MC.GetMsgInfo(userId, cursor, count);

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time   = FunctionHelper.GetTimestamp();
                jsonModel.status = 1;
                jsonModel.msg    = "成功";
                jsonModel.data   = data;
                return(jsonModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public JsonResult DeleteAllSelectedCard()
        {
            try
            {
                var host = Request.Url.Host;
                Session[string.Format("{0}_{1}", SessionConfig.CardActiveParkingSession, host)] = new List <tblCardExtend>();

                var result = new MessageReport();
                result.Message   = FunctionHelper.GetLocalizeDictionary("Home", "notification")["LstDelSuccess"];
                result.isSuccess = true;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                var result = new MessageReport();
                result.Message   = ex.Message;
                result.isSuccess = false;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
예제 #30
0
        private void ucGiaKeHoach_Load(object sender, EventArgs e)
        {
            lueDVT.DataSource = FunctionHelper.LoadDM("select * from DM_DVT");
            lueGoiThau.Properties.DataSource = FunctionHelper.LoadGoiThau();
            try
            {
                lueGoiThau.ItemIndex = 0;
            }
            catch
            {
            }
            //lueGoiThau.EditValue =Convert.ToInt32( clsParameter._goiThauID);
            lueGridGoiThau.DataSource = lueGoiThau.Properties.DataSource;
            CommandData();
            SelectData(chkAll.Checked);
            FormStatus = EnumFormStatus.VIEW;
            FunctionHelper.PermissionLockButton(btnControl);

            FormHelper.LookUpEdit_Init(lueGoiThau);
        }