Ejemplo n.º 1
0
        /// <summary>Function to retrieve the default content name, and data.</summary>
        /// <param name="generatedName">A default name generated by the application.</param>
        /// <returns>The default content name along with the content data serialized as a byte array. If either the name or data are <b>null</b>, then the user cancelled..</returns>
        /// <remarks>
        /// <para>
        /// Plug in authors may override this method so a custom UI can be presented when creating new content, or return a default set of data and a default name, or whatever they wish.
        /// </para>
        /// <para>
        /// If an empty string (or whitespace) is returned for the name, then the <paramref name="generatedName"/> will be used.
        /// </para>
        /// </remarks>
        protected override Task <(string name, byte[] data)> OnGetDefaultContentAsync(string generatedName)
        {
            var sprite = new GorgonSprite
            {
                Anchor = new DX.Vector2(0.5f, 0.5f),
                Size   = new DX.Size2F(1, 1)
            };

            byte[] data;

            using (var stream = new MemoryStream())
            {
                _defaultCodec.Save(sprite, stream);
                data = stream.ToArray();
            }

            using (var formName = new FormName
            {
                Text = Resources.GORSPR_CAPTION_SPRITE_NAME,
                ObjectName = generatedName ?? string.Empty,
                ObjectType = ContentType
            })
            {
                if (formName.ShowDialog(GorgonApplication.MainForm) == DialogResult.OK)
                {
                    return(Task.FromResult((formName.ObjectName, data)));
                }
            }

            return(Task.FromResult <(string, byte[])>((null, null)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutFormName([FromRoute] string id, [FromBody] FormName formName)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != formName.Id)
            {
                return(BadRequest());
            }

            _context.Entry(formName).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FormNameExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 3
0
        protected override void Execute(CodeActivityContext context)
        {
            // TODO: VALIDATE ENTITY OR THROW EXCEPTION


            Workflows.UserInteractions.Request.RequireFormRequest request = new UserInteractions.Request.RequireFormRequest();

            request.EntityType = Entity.Get(context).EntityType;

            request.EntityObjectId = WorkflowManager.Get(context).Application.EntityObjectIdGet(Entity.Get(context));


            if (Form.Get(context) == null)
            {
                // LOAD FORM BY NAME (NO FORM WAS PASSED FROM PARENT ACTIVITY)

                request.Form = new Core.Forms.Form(WorkflowManager.Get(context).Application, FormName.Get(context));

                if (request.Form == null)
                {
                    CommonFunctions.RaiseActivityException(  // THROW EXCEPTION

                        WorkflowManager.Get(context).Application,

                        1,

                        WorkQueueItemId.Get(context),

                        WorkflowSteps.Get(context),

                        "Unable to load form for " + FormName.Get(context) + "."

                        );
                }

                request.Form.EntityType = request.EntityType;

                request.Form.EntityObjectId = request.EntityObjectId;
            }

            else
            {
                request.Form = Form.Get(context);
            }                                           // USE FORM PASSED IN FROM PARENT ACTIVITY

            request.Form.FormType = Core.Forms.Enumerations.FormType.Instance;


            request.Message = "Form Required: " + request.Form.Name + " (Last Modified: " + request.Form.ModifiedAccountInfo.ActionDate.ToString("MM/dd/yyyy") + ")";

            request.AllowSaveAsDraft = AllowSaveAsDraft.Get(context);

            request.AllowCancel = AllowCancel.Get(context);


            UserInteractionRequest.Set(context, request);

            return;
        }
Ejemplo n.º 4
0
 public void CreateNewPatientForm()
 {
     FormName.SendKeys(Constant.fieldName);
     utility.ClickDropdownAndEnter(FormSelectDepartment);
     utility.ClickDropdownAndEnter(FormSelectCategory);
     FormTitle.SendKeys(Constant.fieldName);
     FillFormWithComponents();
     SaveForm.ClickOn();
     softAssert.VerifySuccessMsg();
 }
Ejemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (FormName != null ? FormName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ FormSize.GetHashCode();
         hashCode = (hashCode * 397) ^ FormPosition.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)WindowState;
         return(hashCode);
     }
 }
Ejemplo n.º 6
0
        public async Task <IActionResult> PostFormName([FromBody] FormName formName)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.FormNames.Add(formName);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFormName", new { id = formName.Id }, formName));
        }
Ejemplo n.º 7
0
        public ChooseGroupForm(User i_LoggedInUser, FormName i_FormName)
        {
            m_LoggedInUser = i_LoggedInUser;
            m_FormName     = i_FormName;
            InitializeComponent();
            try
            {
                foreach (Group group in m_LoggedInUser.Groups)
                {
                    userGroups.Items.Add(group.Name);
                }
            }

            catch (Exception e) {
                MessageBox.Show("Unable to fetch user's groups information because facebook doesn't allow");
            }
        }
Ejemplo n.º 8
0
        public void CNCShowForm(FormName formname)
        {
            int num = (int)formname;

            if (userControls != null && userControls.Count > 0)
            {
                UserControl thisUserControl = userControls[num];
                if (Workpanel.Controls.Contains(thisUserControl))
                {
                    thisUserControl.BringToFront();
                }
                else
                {
                    this.Workpanel.Controls.Add(thisUserControl);
                    thisUserControl.Dock = DockStyle.Fill;
                    thisUserControl.BringToFront();
                }
            }
        }
Ejemplo n.º 9
0
        private void SaveFile(string type)
        {
            switch (type)
            {
            case "HDD":
                SaveFileDialog sf = new SaveFileDialog();
                sf.Title    = "Save file to " + type;
                sf.Filter   = "XML|*.xml|JSON|*.json|TXT|*.txt|All files(*.*)|*.*";
                sf.FileName = GlobalFileInfo.FileName;

                if (sf.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                string fileName = System.IO.Path.GetFileNameWithoutExtension(sf.FileName);

                System.IO.File.WriteAllText(sf.FileName, rtb_MainEditor.Text);

                SetGlobalFileName(System.IO.Path.GetFileNameWithoutExtension(sf.FileName), System.IO.Path.GetExtension(sf.FileName));
                _InfoLabel.Print(fileName + " saved. Storage: " + type);
                break;

            case "Database":
                using (var fileNameForm = new FormName(GlobalFileInfo.FileName, GlobalFileInfo.FileType))
                {
                    var result = fileNameForm.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        string content = rtb_MainEditor.Text;

                        //Save file in task
                        Task.Run(() => DatabaseHelper.SaveFileToDatabase(content, fileNameForm.FileName, fileNameForm.FileType, _InfoLabel));

                        SetGlobalFileName(fileNameForm.FileName, fileNameForm.FileType);
                    }
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 10
0
        private static void Click_Handler(FormName openForm, Form form)
        {
            try
            {
                switch (openForm)
                {
                case FormName.Formatter:
                    new FormatForm().Show();
                    break;

                case FormName.ConnectionStirng:
                    new ConnectForm().Show();
                    break;

                case FormName.CheckWeb:
                    new CheckWebForm().Show();
                    break;

                case FormName.MongoLog:
                    new MongoForm().Show();
                    break;

                case FormName.Base64:
                    new Base64Form().Show();
                    break;

                default:
                    MessageBox.Show(string.Concat("Form ", openForm, " is not defined."));
                    break;
                }
                form.Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Concat("Form Failed:", ex.ToString()));
            }
        }
Ejemplo n.º 11
0
        void trayIcon_DoubleClick(object sender, EventArgs e)
        {
            FormName showWindow = new FormName();

            showWindow.Show();
        }
Ejemplo n.º 12
0
        void restore_Click(object sender, EventArgs e)
        {
            FormName showWindow = new FormName();

            showWindow.Show();
        }
        /// <summary>
        /// 对ModuleConfig进行再处理,FormName不为空时则只对单个Form处理(例如,多表中对某张表进行查询)
        /// </summary>
        /// <param name="moduleConfig"></param>
        /// <returns></returns>
        private ModuleConfig AnalysisModule(ModuleConfig moduleConfig)
        {
            FormConfigs = moduleConfig.Forms.Where(a => a is FormConfig)
                          .Cast <FormConfig>()
                          .Where(a => IsSupportPage(a.SupportPage, this.PageStyle));
            MvcFormConfigs = moduleConfig.Forms.Where(a => a is MvcFormConfig) == null ? null :
                             moduleConfig.Forms.Where(a => a is MvcFormConfig).Cast <MvcFormConfig>();
            SeaFormConfigs = moduleConfig.Forms.Where(a => a is SeaFormConfig) == null ? null :
                             moduleConfig.Forms.Where(a => a is SeaFormConfig).Cast <SeaFormConfig>();

            ScriptFormConfigs = moduleConfig.Forms.Where(a => a is ScriptFormConfig) == null ? null :
                                moduleConfig.Forms.Where(a => a is ScriptFormConfig).Cast <ScriptFormConfig>();

            //if (moduleConfig.Mode == ModuleMode.MasterDetail)
            //{
            // AtawDebug.AssertArgumentNull(moduleConfig.Relations, "主从表必须配置Relation", this);
            //BasePageView.KeyValue = KeyValue;  //主从表修改时,主表主键需要传递给前台
            // }
            #region 非空属性赋值
            //Form配置中Name或TableName或Title可能没有值,此时需要赋值
            moduleConfig.Forms.ForEach(a =>
            {
                if (a is FormConfig)
                {
                    var form     = a as FormConfig;
                    var dataForm = form.File.InstanceByPage <DataFormConfig>(a.Name);

                    if (form.TableName.IsEmpty())
                    {
                        form.TableName = dataForm.TableName;
                    }
                    if (form.TableName.IsEmpty())
                    {
                        form.TableName = form.DataPlug.InstanceByPage <IListDataTable>(a.Name).RegName;
                    }
                    if (a.Name.IsEmpty())
                    {
                        a.Name = dataForm.Name;
                    }
                    if (a.Name.IsEmpty())
                    {
                        a.Name = form.TableName;
                    }
                    a.Width    = form.Width;
                    string msg = string.Format("数据源为{0}插件的form的名称不能为空", form.DataPlug);
                    AtawDebug.AssertNotNullOrEmpty(form.Name, msg, this);

                    if (a.Title.IsEmpty())
                    {
                        a.Title = dataForm.Title;
                    }
                    if (a.Title.IsEmpty())
                    {
                        a.Title = moduleConfig.Title;
                    }
                }
                if (a is MvcFormConfig)
                {
                    var mvcForm = a as MvcFormConfig;
                    AtawDebug.AssertNotNull(mvcForm.DataRoute, "MvcForm需要配置DataRoute", this);
                    var dataRoute = AtawAppContext.Current.MvcConfigXml.DataRoutes.FirstOrDefault(route => route.Name == mvcForm.DataRoute.Name);
                    if (dataRoute != null)
                    {
                        mvcForm.DataRoute.ActionName  = dataRoute.ActionName;
                        mvcForm.DataRoute.ControlName = dataRoute.ControlName;
                        mvcForm.DataRoute.AreaName    = dataRoute.AreaName;
                        mvcForm.DataRoute.NameSpace   = dataRoute.NameSpace;
                    }
                    else
                    {
                        if (mvcForm.DataRoute.ControlName.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.ControlName, "DataRoute的ControlName不能为空", this);
                        }
                        if (mvcForm.DataRoute.ActionName.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.ActionName, "DataRoute的ActionName不能为空", this);
                        }
                        if (mvcForm.DataRoute.AreaName.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.AreaName, "DataRoute的AreaName不能为空", this);
                        }
                        if (mvcForm.DataRoute.NameSpace.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.NameSpace, "DataRoute的NameSpace不能为空", this);
                        }
                    }
                }
            });
            #endregion

            #region 主从表批量修改或显示明细时,现只针对主表操作
            if (PostDataSet != null && PostDataSet.Tables.Count > 0)
            {
                DataTable dt = PostDataSet.Tables["_KEY"];
                if (dt != null)
                {
                    if (dt.Rows.Count > 1)
                    {
                        moduleConfig.Mode = ModuleMode.Single;
                    }
                    //else if (dt.Rows.Count == 1)
                    //    BasePageView.KeyValue = dt.Rows[0][0].ToString();


                    var keyValueList = new List <string>();
                    foreach (DataRow row in dt.Rows)
                    {
                        string _key = row["KeyValue"].ToString();
                        keyValueList.Add(_key);
                    }
                    BasePageView.KeyValue = String.Join <string>(",", keyValueList);
                }
            }
            #endregion

            if (FormName.IsEmpty())
            {
                if (moduleConfig.Mode == ModuleMode.Single || moduleConfig.Mode == ModuleMode.MasterDetail ||
                    moduleConfig.Mode == ModuleMode.SingleToSingle)
                {
                    var form     = FormConfigs.FirstOrDefault(a => a.IsMainTable);
                    var mainForm = form == null?FormConfigs.FirstOrDefault() : form;  //若没有配置主表,则指定第一个为主表

                    mainForm.IsMainTable = true;
                    switch (PageStyle)
                    {
                    case PageStyle.List:
                        moduleConfig.Forms.Clear();
                        mainForm.HasSearch = true;
                        moduleConfig.Forms.Add(mainForm);
                        moduleConfig.HasReview = mainForm.HasReview;
                        break;

                    case PageStyle.Insert:
                    case PageStyle.Update:
                    case PageStyle.Review:
                    case PageStyle.Detail:
                        mainForm.FormType = FormType.Normal;
                        if (moduleConfig.Mode == ModuleMode.Single)
                        {
                            moduleConfig.Forms.Clear();
                            moduleConfig.Forms.Add(mainForm);
                            moduleConfig.HasReview = mainForm.HasReview;
                        }
                        else
                        {
                            //var detailForms = FormConfigs.Where(a => !a.IsMainTable);
                            //foreach (FormConfig item in detailForms)
                            //{
                            //    item.FormType = FormType.Grid;
                            //}
                        }
                        break;
                    }
                }
            }
            else
            {
                var form = moduleConfig.Forms.Find(a => a.Name == FormName);
                AtawDebug.AssertNotNull(form, string.Format(ObjectUtil.SysCulture, "请求的formname:  {0}不存在,请检查xml文件是否有问题", FormName), this);
                //var mainForm = form == null ? moduleConfig.Forms.First() : form;//若没有配置主表,则指定第一个为主表
                //if (PageStyle == PageStyle.Insert || PageStyle == PageStyle.Detail || PageStyle == PageStyle.Update)
                //{
                //    mainForm.FormType = FormType.Normal;
                //}
                //if (moduleConfig.Mode == ModuleMode.Single)
                //{
                moduleConfig.Forms.Clear();
                moduleConfig.Forms.Add(form);
                // }
            }

            return(moduleConfig);
        }
Ejemplo n.º 14
0
 private void ManageCustomePermissions()
 {
     GetCustomePermissions(FormName.ToString());
 }
Ejemplo n.º 15
0
 private void ManagePermissions()
 {
     GetItemPermissions(FormName.ToString());
 }
Ejemplo n.º 16
0
 private void BtnLookup_OnClick(object sender, RoutedEventArgs e)
 {
     GeneralFilter.NavigatToMenu(FormName.ToString(), Title, null);
 }