/// <summary>
        /// show warning message box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static Task <bool> ShowWarning(Window sender, string message)
        {
            var warningMessageBox = new WarningMessageBox(null, message)
            {
                Width  = MESSAGE_BOX_WIDTH,
                Height = MESSAGE_BOX_HEIGHT
            };

            return(warningMessageBox.ShowDialog <bool>(sender));
        }
Beispiel #2
0
 /** <summary> Creates a new water object. </summary> */
 private void New(object sender, EventArgs e)
 {
     if (!changed || WarningMessageBox.Show(this, "Water object has been changed.", "Are you sure you want to continue?") == DialogResult.Yes)
     {
         waterObject        = (Water)ObjectData.FromBuffer(Resources.WTRCYAN);
         waterObject.Source = SourceTypes.Custom;
         LoadFromObject();
         UpdatePalettes();
         SelectColor();
         fileName = "";
     }
 }
Beispiel #3
0
 /** <summary> Opens the water object. </summary> */
 private void Open(object sender, EventArgs e)
 {
     if (fileName == "")
     {
         openFileDialog.InitialDirectory = "";
         openFileDialog.FileName         = "";
     }
     else
     {
         openFileDialog.InitialDirectory = Path.GetDirectoryName(fileName);
         openFileDialog.FileName         = Path.GetFileNameWithoutExtension(fileName);
     }
     if (!changed || WarningMessageBox.Show(this, "Water object has been changed.", "Are you sure you want to continue?") == DialogResult.Yes)
     {
         if (openFileDialog.ShowDialog(this) == DialogResult.OK)
         {
             fileName = openFileDialog.FileName;
             ObjectData obj     = ObjectData.FromFile(fileName);
             bool       invalid = false;
             if (obj is Water)
             {
                 waterObject = (Water)obj;
                 if (waterObject.GraphicsData.NumPalettes == 7 && waterObject.GraphicsData.NumImages == 0 &&
                     waterObject.GraphicsData.GetPalette(0).Colors.Length == 236 &&
                     waterObject.GraphicsData.GetPalette(1).Colors.Length == 15 &&
                     waterObject.GraphicsData.GetPalette(2).Colors.Length == 15 &&
                     waterObject.GraphicsData.GetPalette(3).Colors.Length == 15 &&
                     waterObject.GraphicsData.GetPalette(4).Colors.Length == 15 &&
                     waterObject.GraphicsData.GetPalette(5).Colors.Length == 15 &&
                     waterObject.GraphicsData.GetPalette(6).Colors.Length == 15)
                 {
                     LoadFromObject();
                     SelectColor();
                     changed = false;
                 }
                 else
                 {
                     invalid = true;
                 }
             }
             else
             {
                 invalid = true;
             }
             if (invalid)
             {
                 ErrorMessageBox.Show(this, "Failed to load water object.", "Object may be invalid.");
             }
         }
     }
 }
        private bool ValidateExcelObject()
        {
            var validation = new ValidationObject();

            validation.StartValidation(ref excelList, excelTemplate);

            if (validation.isError)
            {
                var messageLabel = WarningMessageBox.FindControl("WarningLabel") as System.Web.UI.WebControls.Label;
                messageLabel.Text = validation.GetMassegaForError();
                WarningMessageBox.Show();
                return(false);
            }
            return(true);
        }
Beispiel #5
0
        protected void BtnConstructor_OnClick(object sender, EventArgs e)
        {
            var templateID = TemplateList.SelectedValue;

            treeDesigner.userID = Convert.ToInt32(Session["SystemUser.objID"]);

            if (templateID == "0" || string.IsNullOrEmpty(templateID))
            {
                return;
            }

            if (templateID == "-1")
            {
                if (!AuthorizationRules.TemplateResolution(ActionType.create, Session["SystemUser.objID"].ToString()))
                {
                    WarningMessageBox.Show();
                    return;
                }

                treeDesigner.TemplateID    = null;
                treeDesigner.templateIsNew = true;
                treeDesigner.SortHashtable = null;
            }
            else
            {
                if (!AuthorizationRules.TemplateResolution(ActionType.read, Session["SystemUser.objID"].ToString(), templateID))
                {
                    WarningMessageBox.Show();
                    return;
                }

                treeDesigner.TemplateID    = templateID;
                treeDesigner.SortHashtable = Session["SortTemplate" + templateID] == null
                    ? new Hashtable()
                    : (Hashtable)Session["SortTemplate" + templateID];
            }

            treeDesigner.EntityID = EntityList.SelectedItem.Value;

            treeDesigner.template     = null;
            treeDesigner.selectedID   = treeDesigner.buttonAttributID = null;
            treeDesigner.isDialogShow = false;

            treeDesigner.DataBind();

            MainView.ActiveViewIndex = 1;
        }
        protected void ConstructorButton_Click(object sender, EventArgs e)
        {
            //Не открываем конструктор если не выбран Entity
            if (string.IsNullOrEmpty(EntityList.SelectedValue))
            {
                return;
            }

            var userID = Convert.ToInt32(Session["SystemUser.objID"]);



            CrossTemplate.userID = userID;

            if (TemplateList.SelectedIndex == 0)
            {
                if (!AuthorizationRules.TemplateResolution(ActionType.create, Session["SystemUser.objID"].ToString()))
                {
                    WarningMessageBox.Show();
                    return;
                }
            }
            else
            {
                if (!AuthorizationRules.TemplateResolution(
                        ActionType.read,
                        Session["SystemUser.objID"].ToString(),
                        TemplateList.SelectedValue))
                {
                    WarningMessageBox.Show();
                    return;
                }
            }

            multiView.ActiveViewIndex = 1;
            CrossTemplate.template    = null;

            if (TemplateList.SelectedValue != "-1")
            {
                CrossTemplate.TemplateID = TemplateList.SelectedValue;
            }

            CrossTemplate.EntityID = EntityList.SelectedValue;
            CrossTemplate.DataBind();
        }
        private void SaveExcelObjects(string xml)
        {
            bool isAllRight = true;

            using (var c = new SqlConnection(Teleform.ProjectMonitoring.HttpApplication.Global.ConnectionString))
                using (var command = new SqlCommand(xml, c))
                {
                    c.Open();
                    SqlTransaction transaction = c.BeginTransaction();

                    try
                    {
                        command.Transaction = transaction;
                        command.ExecuteScalar();

                        transaction.Commit();
                    }
                    catch (SqlException ex)
                    {
                        transaction.Rollback();
                        isAllRight = false;

                        string duplecateObjects = ErrorHandling(ex.Errors);

                        var messageLabel = WarningMessageBox.FindControl("WarningLabel") as System.Web.UI.WebControls.Label;
                        messageLabel.Text = duplecateObjects;
                        WarningMessageBox.Show();
                    }
                }
            if (isAllRight)
            {
                var messageLabel = WarningMessageBox.FindControl("WarningLabel") as System.Web.UI.WebControls.Label;
                messageLabel.Text = "Данные успешно сохранены в тип объекта : " + excelTemplate.Entity.Name;
                WarningMessageBox.Show();
            }
        }