Beispiel #1
0
        public void GetAllPersonnelTotalSummaryTimesheetViewTest()
        {
            var pc = Engine.Controllers.AbstractControllers
                     .EngineUtility.InitializeMockControllerContext(new PersonnelTaradodInfoController())
                     as PersonnelTaradodInfoController;

            pc.MockAreaName = "Absence";

            var res = pc.GetAllPersonnelTotalSummaryTimesheetView
                          () as ViewResult;

            // assert
            res
            .AssertViewRendered();
            //   res.ExecuteResult(pc.ControllerContext);


            Assert.NotNull(res.ViewData[UiHomeController.Form]);
            Assert.NotNull(res.ViewData[UiHomeController.DataTable]);
            Assert.NotNull(res.ViewData[UiHomeController.TableObject]);

            UiForm form = res.ViewData[UiHomeController.Form] as UiForm;


            Assert.True(res.ViewData[UiFormEngineController.PostSubsystemUrl] == "Absence");
            // Assert.True(res.ViewData[UiFormEngineController.PostControllerUrl]=="PersonnelTaradodInfo");
            Assert.True(res.ViewData[UiFormEngineController.PostActionUrl] == "GetAllPersonnelTotalSummaryTimesheet");

            Assert.Contains(form.UiFormInputs, u => u.UiInput.Name == "from");
            Assert.Contains(form.UiFormInputs, u => u.UiInput.Name == "to");
        }
Beispiel #2
0
        private UiForm GetForm()
        {
            var uiform = new UiForm();

            uiform.Name      = "WorkGroupObligatedRange";
            uiform.Translate = "بازه موظفی گروه کاری";

            UiFormInput WorkGroupId = GetDropDownInput("WorkGroup", MethodType.GetDropDown, "Absence",
                                                       "WorkGroupId", "گروه کاری", FieldType.DropDown);



            UiFormInput ObligatedRangeId = GetDropDownInput("ObligatedRanges", MethodType.GetDropDown, "Absence",
                                                            "ObligatedRangeId", "بازه موظفی", FieldType.DropDown);

            uiform.UiFormInputs.Add(WorkGroupId);
            uiform.UiFormInputs.Add(ObligatedRangeId);

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "DateTime", Translate = "تاریخ شروع به کار", FieldType = FieldType.Date
                }
            });


            return(uiform);
        }
        private UiForm GetForm()
        {
            /*public  long MachineId{ get; set; }
             * public long   PersonnelId{ get; set; }
             * public long   UserIdInMachine{ get; set; }*/
            var uiform = new UiForm();

            uiform.Name      = "SavePersonnel";
            uiform.Translate = "ثبت پرسنل جدید";
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name        = "UserIdInMachine"
                    , Translate = "کد کاربر در دستگاه", FieldType = FieldType.Text
                }
            });


            UiFormInput input = GetDropDownInput("Machines", MethodType.GetDropDown, "Absence",
                                                 "MachineId", "دستگاه", FieldType.DropDown);

            UiFormInput PersonnelId = GetDropDownInput("Personnel", MethodType.GetDropDown, "Absence",
                                                       "PersonnelId", "پرسنل", FieldType.DropDown);

            uiform.UiFormInputs.Add(input);
            uiform.UiFormInputs.Add(PersonnelId);


            return(uiform);
        }
Beispiel #4
0
        private UiForm GetForm()
        {
            /*long personnelId, DateTime fromdate, DateTime dateto*/
            var uiform = new UiForm();

            uiform.Name      = "SearchPersonnel";
            uiform.Translate = "فیلتر";

            /*
             * UiFormInput PersonnelId = GetDropDownInput("Personnel", MethodType.GetDropDown, "Absence",
             *  "personnelId", "پرسنل", FieldType.DropDown);
             *
             * uiform.UiFormInputs.Add(PersonnelId);
             */


            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "from", Translate = "تاریخ از", FieldType = FieldType.Date
                }
            });

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "to", Translate = "تاریخ تا", FieldType = FieldType.Date
                }
            });


            return(uiform);
        }
        private UiForm GetForm()
        {
            var uiform = new UiForm();

            uiform.Name      = "SavePersonnel";
            uiform.Translate = "ثبت پرسنل جدید";
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Name", Translate = "نام", FieldType = FieldType.Text
                }
            });
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "LastName", Translate = "نام خانوادگی", FieldType = FieldType.Text
                }
            });
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Code", Translate = "کد ملی", FieldType = FieldType.Text
                }
            });


            UiFormInput input = GetDropDownInput("WorkGroup", MethodType.GetDropDown, "Absence",
                                                 "WorkGroupId", "گروه کاری", FieldType.DropDown);


            uiform.UiFormInputs.Add(input);


            return(uiform);
        }
        public void SetDynamicTableViewDataHelper(dynamic res,
                                                  string tableControllerName = null,
                                                  string tableActionName     = null, string tableAreaName = null,
                                                  string formControllerName  = null,
                                                  string formActionName      = null, string formAreaName = null, bool withform = true)
        {
            string actionName     = tableAreaName ?? ControllerContext.RouteData.Values["action"].ToString();
            string controllerName = tableControllerName ?? GetCurrentControllerName();
            string areaName       = tableActionName ?? GetCurrentAreaName();


            TableConstructProvider.CurrentArea       = areaName;
            TableConstructProvider.CurrentController = controllerName;
            TableConstructProvider.CurrentAction     = actionName;

            UiForm form = null;

            if (withform)
            {
                form = SetDynamicFormViewData(false, formControllerName ?? controllerName, formActionName ?? actionName,
                                              formAreaName ?? areaName);
            }
            SetDynamicTableViewData(GetTableNamePattern(), areaName,
                                    controllerName, actionName, res, form);
        }
Beispiel #7
0
 public void GetForm(UiForm form, string postSubsystemUrl, string postControllerUrl,
                     string postActionUrl, ViewDataDictionary viewData)
 {
     viewData[UiFormEngineController.DynamicFormUiFormInputs] = form.UiFormInputs;
     viewData[UiFormEngineController.PostSubsystemUrl]        = postSubsystemUrl;
     viewData[UiFormEngineController.PostControllerUrl]       = postControllerUrl;
     viewData[UiFormEngineController.PostActionUrl]           = postActionUrl;
     viewData[UiHomeController.Form] = form;
 }
        private UiForm GetForm()
        {
            var uiform = new UiForm();

            uiform.Name      = "Workplaces";
            uiform.Translate = "ثبت مکان کاری جدید";

            Workplace sp;

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Name", Translate = "نام مکان", FieldType = FieldType.Text
                }
            });
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput
                {
                    Name      = "oneDeviceEnabled", Translate = "استفاده از یک دستگاه برای ورود برای این گروه کاری ",
                    FieldType = FieldType.Text, InputType = InputType.Checkbox
                }
            });
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput
                {
                    Name      = "IsNotificationsEnabled",
                    Translate = " خبر رسانی فعال باشد ",
                    FieldType = FieldType.Text,
                    InputType = InputType.Checkbox
                }
            });

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput
                {
                    Name      = "IsFaceRecognationEnabled",
                    Translate = "تشخیص چهره فعال باشد",
                    FieldType = FieldType.Text,
                    InputType = InputType.Checkbox
                }
            });


            UiFormInput input = GetDropDownInput("UserClockTypesarr", "نواع ساعت زنی", FieldType.MultiSelect,
                                                 GetEnumSelectList <ClockType>());


            uiform.UiFormInputs.Add(input);


            return(uiform);
        }
        private UiForm GetForm()
        {
            var uiform = new UiForm();

            uiform.Name      = "Workplaces";
            uiform.Translate = "دسترسی موبایلی به پرسنل";

            WorkplacePersonnel sp;
            UiFormInput        input = GetDropDownInput("personnel", MethodType.GetDropDown, "Absence",
                                                        "PersonnelId", "پرسنل", FieldType.DropDown);

            uiform.UiFormInputs.Add(input);

            UiFormInput workplaceinput = GetDropDownInput("Workplaces", MethodType.GetDropDown, "Mobile",
                                                          "WorkplaceId", "محل کار", FieldType.DropDown);

            uiform.UiFormInputs.Add(workplaceinput);

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "ApplicationUserUserName", Translate = "نام ادمین", FieldType = FieldType.Text
                }
            });


            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Username", Translate = "نام کاربری", FieldType = FieldType.Text, PlaceHolder = "پیشفرض کد ملی پرسنل"
                }
            });

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Password", Translate = "رمز عبور", FieldType = FieldType.Text, PlaceHolder = "پیشفرض کد ملی پرسنل"
                }
            });


            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput
                {
                    Name      = "IsAdmin", Translate = "آیا ادمین محل کاری است ؟ ",
                    FieldType = FieldType.Text, InputType = InputType.Checkbox
                }
            });



            return(uiform);
        }
Beispiel #10
0
        private UiForm GetForm()
        {
            var uiform = new UiForm();

            uiform.Name      = "SaveWorkGroup";
            uiform.Translate = "ثبت گروه کاری جدید";
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Name", Translate = "نام", FieldType = FieldType.Text
                }
            });

            return(uiform);
        }
        private UiForm GetForm()
        {
            var uiform = new UiForm();

            uiform.Name      = "SaveManualAttendance";
            uiform.Translate = "ثبت فراموشی کارت";

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Time", Translate = "زمان", FieldType = FieldType.Time
                }
            });

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Date", Translate = "تاریخ", FieldType = FieldType.Date
                }
            });



            using (var db = new EngineContext())
            {
                var l = db.PersonnelMachines.Select(p => p.Personnel).Select(p => new SelectListItem
                {
                    Text = p.Name + " " + p.LastName, Value = p.Id.ToString()
                }).ToList();
                var         selectList = new SelectList(l);
                UiFormInput UserId     = GetDropDownInput("UserId", "کاربر", FieldType.DropDown,
                                                          selectList);

                uiform.UiFormInputs.Add(UserId);
            }

            UiFormInput Type = GetDropDownInput("Type", "نوع", FieldType.DropDown,
                                                GetEnumSelectList <BiometricDataType>());


            uiform.UiFormInputs.Add(Type);


            return(uiform);
        }
        protected virtual UiForm SetDynamicFormViewData
            (bool isSave, string controllerName, string action, string areaName)
        {
            UiForm form = null;

            if (isSave)
            {
                form = FormConstructProvider.GetSaveForm();
            }
            else
            {
                form = FormConstructProvider.GetDataTableSearchForm();
            }

            if (form != null)
            {
                UiFormDataProvider.GetForm(form, areaName, controllerName, action
                                           , ViewData);
            }
            return(form);

/*
 *
 *          if (actionName.ToLower() == nameof(GetDataTable).ToLower())
 *          {
 *
 *              if (form == null)
 *                  return form;
 *
 *              string controllerName = ControllerContext.RouteData.Values["controller"].ToString();
 *              string areaName = (string) HttpContext.Request.RequestContext.RouteData.DataTokens["area"];
 *
 *              UiFormDataProvider.GetForm(form, areaName, controllerName, actionName
 *                  , ViewData);
 *              return form;
 *          }
 *
 *          throw new Exception("فرم مورد نظر یافت نشد");*/
            //از خود جدول فرم انتخاب کن نه از فرم های جداول

            /*_uiFormDataProvider.GetForm(formName, ViewData, isTableForm: false,
             *  postType: UiFormControllerMethodType.Save);*/
        }
        private UiForm GetForm()
        {
            /*IP: string;
             * MachineId: number;
             * Name: string;
             * PersonnelMachines: PersonnelMachine[];
             * Port: string;*/
            var uiform = new UiForm();

            uiform.Name      = "SaveMachine";
            uiform.Translate = "ثبت دستگاه";
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Name", Translate = "نام", FieldType = FieldType.Text
                }
            });
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "IP", Translate = "IP", FieldType = FieldType.Text
                }
            });
            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "Port", Translate = "Port", FieldType = FieldType.Text
                }
            });

            uiform.UiFormInputs.Add(new UiFormInput
            {
                UiInput = new UiInput {
                    Name = "MachineId", Translate = "کد دستگاه", FieldType = FieldType.Text
                }
            });

            return(uiform);
        }
Beispiel #14
0
        public UiForm GetForm(string formName, ViewDataDictionary ViewData, bool isTableForm,
                              UiFormControllerMethodType postType)
        {
            formName = formName.ToLower().TrimEnd();
            using (var db = new EngineContext())
            {
                UiForm form = null;
                if (isTableForm)
                {
                    form = db.UiTableForms.Where(u => u.Name.ToLower().TrimEnd() == formName).
                           Select(u => u.UiForm).FirstOrDefault();
                }
                else
                {
                    form = db.UiForms.Where(u => u.Name.ToLower().TrimEnd() == formName).FirstOrDefault();
                }
                if (form == null)
                {
                    throw new Exception("فرم یافت نشد");
                }

                ViewData[UiFormEngineController.DynamicFormUiFormInputs] = db.UiFormInputs.Include(d => d.UiInput).Include(d => d.UiInput.UiInputMethods).Include(d => d.UiInput.UiInputMethods.Select(m => m.DefineControllerMethod)).Where(d => d.UiFormId == form.Id).ToList();

                var method = form.UiFormControllerMethods.Where(d => d.Type == postType).Select(u => u.DefineControllerMethod).FirstOrDefault();
                if (method == null)
                {
                    throw new Exception("فرم مورد نظر متد ندارد");
                }

                var controllerName = method.DefineController.Name.Replace("Controller", "");

                ViewData[UiFormEngineController.PostSubsystemUrl]  = method.DefineController.SubSystem.Name;
                ViewData[UiFormEngineController.PostControllerUrl] = controllerName;
                ViewData[UiFormEngineController.PostActionUrl]     = method.Name;
                ViewData[UiHomeController.Form] = form;
                return(form);
            }
        }
Beispiel #15
0
        public ActionResult Create(long modelId, string subSystemName)
        {
            try
            {
                using (var db = new EngineContext())
                {
                    var model = db.Models.Find(modelId);
                    if (model == null)
                    {
                        throw new Exception("model is null");
                    }

                    if (model.DefineControllers.Count > 0)
                    {
                        throw new Exception("قبلا برای این مدل کنترلر تعریف شده است");
                    }

                    var subsystem = new SubSystem();
                    subsystem.Name = subSystemName;

                    var service = new DefineService();
                    service.Name      = model.Name + "sService";
                    service.ModelId   = model.Id;
                    service.Translate = model.Translate + " سرویس ";

                    service.ServiceMethods = GetDefaultServices();

                    subsystem.DefineServices.Add(service);

                    var controller = new DefineController();
                    controller.Name      = model.Name + "sController";
                    controller.ModelId   = model.Id;
                    controller.Translate = model.Translate + " کنترولر ";

                    controller.DefineControllerMethods = GetDefaultControllers();

                    subsystem.DefineControllers.Add(controller);


                    var table = new EjTable();
                    table.Name         = model.Name + "sTable";
                    table.Translate    = model.Translate + " جدول ";
                    table.UiTableItems = GetDefaultItemsForTable();
                    table.TableMethods.Add(new TableMethod
                    {
                        DefineControllerMethod = controller.DefineControllerMethods.First(d =>
                                                                                          d.MethodType == MethodType.GetDataTable),
                    });

                    var form = new UiForm();
                    form.Name      = model.Name + "sForm";
                    form.Translate = model.Translate + " ثبت ";
                    form.UiFormControllerMethods.Add(new UiFormControllerMethod
                    {
                        DefineControllerMethod = controller.DefineControllerMethods.First(d =>
                                                                                          d.MethodType == MethodType.Save),
                        Type      = UiFormControllerMethodType.Save,
                        Translate = "ثبت"
                    });
                    form.UiFormControllerMethods.Add(new UiFormControllerMethod
                    {
                        DefineControllerMethod = controller.DefineControllerMethods.First(d =>
                                                                                          d.MethodType == MethodType.Save),
                        Type      = UiFormControllerMethodType.Search,
                        Translate = "جستجو"
                    });

                    var tableSearchForm = new UiTableForm();
                    tableSearchForm.UiForm    = form;
                    tableSearchForm.EjTable   = table;
                    tableSearchForm.Translate = form.Translate;
                    tableSearchForm.Name      = tableSearchForm.Name;
                }

                return(View());
            }
            catch (Exception e)
            {
                ViewBag.alertmsg = e.Message;
                return(View("GetDataTable"));
            }
        }
        protected virtual void SetDynamicTableViewData(string actionName,
                                                       string subSystemName, string controllerName,
                                                       string controllerMethod, IDataTable table, UiForm form)
        {
            EjTable ejtable = TableConstructProvider.GetDataTable(actionName);

            ejtable.UiTableForms.Add(new UiTableForm
            {
                EjTable = ejtable, UiForm = form
            });

            UiEngineDataProvider.GetTable(ejtable, ViewData, Request,
                                          controllerName, controllerMethod, null, table);

            /*_uiEngineDataProvider.GetTable(tableName, ViewData, Request, SubSystemName,
             *  ControllerName, ControllerMethod, null, table);*/
        }