public static void LoadFiles(AddFunc addFunc)
        {
            TextAsset dirTxt = Resources.Load<TextAsset>(HFT_WEB_DIR);
            if (dirTxt == null)
            {
                Debug.LogError("could not load: " + HFT_WEB_DIR);
                return;
            }

            Deserializer deserializer = new Deserializer();
            string[] files = deserializer.Deserialize<string[] >(dirTxt.text);

            foreach (string file in files)
            {
                string path = HFT_WEB_PATH + file;
                TextAsset asset = Resources.Load(path) as TextAsset;
                if (asset == null)
                {
                    Debug.LogError("Could not load: " + path);
                }
                else
                {
                    addFunc(file, asset.bytes);
                }
            }
        }
 public void btnSave_Click(object sender, EventArgs e)
 {
     try {
         if (PerformValidation())
         {
             CopyGUI2BL();
             if (_FormMode == FormMode.New)
             {
                 Employee.AddEmployee(_obj);
                 AddFunc.MsgInfo("Data Add Succesful!");
             }
             else if (_FormMode == FormMode.Update)
             {
                 _obj.Id = Convert.ToInt16(dgResult.Rows[RowIndex].Cells["Id"].Value.ToString());
                 Employee.EditEmployee(_obj);
                 AddFunc.MsgInfo("Data Edit Succesful!");
             }
             RefresDG();
         }
     }
     catch (Exception ex)
     {
         AddFunc.MsgError(ex.Message);
     }
 }
Beispiel #3
0
    /// <summary>
    /// Add a new context menu entry.
    /// </summary>

    static void AddChildWidget(string item, bool isChecked, AddFunc callback)
    {
        if (callback != null)
        {
            if (mMenu == null)
            {
                mMenu = new GenericMenu();
            }
            int count = 0;

            for (int i = 0; i < mEntries.size; ++i)
            {
                string str = mEntries[i];
                if (str == item)
                {
                    ++count;
                }
            }
            mEntries.Add(item);

            if (count > 0)
            {
                item += " [" + count + "]";
            }
            mMenu.AddItem(new GUIContent(item), isChecked, AddChild, callback);
        }
        else
        {
            AddDisabledItem(item);
        }
    }
    /// <summary>
    /// Add a new context menu entry.
    /// </summary>

    static public void AddSiblingWidget(string item, bool isChecked, AddFunc callback)
    {
        if (callback != null)
        {
            if (mMenu == null)
            {
                mMenu = new GenericMenu();
            }
            var count = 0;

            for (var i = 0; i < mEntries.Count; ++i)
            {
                var str = mEntries[i];
                if (str == item)
                {
                    ++count;
                }
            }
            mEntries.Add(item);

            if (count > 0)
            {
                item += " [" + count + "]";
            }
            mMenu.AddItem(new GUIContent(item), isChecked, AddSibling, callback);
        }
        else
        {
            AddDisabledItem(item);
        }
    }
 private void btnsubmit_Click(object sender, EventArgs e)
 {
     try {
         if (PerformValidation())
         {
             if (txtNewPasswd.Text != txtRePasswd.Text)
             {
                 AddFunc.MsgError("Password does not match !");
             }
             else
             {
                 if (txtoldPasswd.Text == txtNewPasswd.Text)
                 {
                     AddFunc.MsgError("New password can not be same old password !");
                 }
                 else
                 {
                     CWUser.ChangePasswordCWUser(txtUsername.Text, txtNewPasswd.Text, txtoldPasswd.Text);
                     AddFunc.MsgInfo("Change Password Succesfull");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         AddFunc.MsgError(ex.Message);
     }
 }
        static public void LoadFiles(AddFunc addFunc)
        {
            TextAsset dirTxt = Resources.Load <TextAsset>(HFT_WEB_DIR);

            if (dirTxt == null)
            {
                Debug.LogError("could not load: " + HFT_WEB_DIR);
                return;
            }

            Deserializer deserializer = new Deserializer();

            string[] files = deserializer.Deserialize <string[]>(dirTxt.text);

            foreach (string file in files)
            {
                string    path  = HFT_WEB_PATH + file;
                TextAsset asset = Resources.Load(path) as TextAsset;
                if (asset == null)
                {
                    Debug.LogError("Could not load: " + path);
                }
                else
                {
                    addFunc(file, asset.bytes);
                }
            }
        }
Beispiel #7
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (AddFunc.MsgQuesYESNO("Are you sure want to delet this order ?"))
     {
         _obj.Invoice_Detail.RemoveAll(x => x.Service_Name == dgResult.Rows[RowIndex].Cells["Service_Name"].Value.ToString());
     }
     RefreshDG();
 }
Beispiel #8
0
 public static void ImplLerp(AddFunc <T> addFunc, MulFunc <T> mulFunc)
 {
     if (isSupportLerp)
     {
         throw new System.InvalidOperationException($"duplicately impl for type : {typeof(T)}");
     }
     _addFunc = addFunc;
     _mulFunc = mulFunc;
 }
Beispiel #9
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (AddFunc.MsgQuesYESNO("Are you sure want to delete this record ?"))
     {
         Packages.DeletePackages(dgResult.Rows[RowIndex].Cells["Id"].Value.ToString());
         AddFunc.MsgInfo("Data Delete Succesfull");
     }
     RefreshDG();
 }
Beispiel #10
0
    /// <summary>
    /// Wrapper function called by the menu that in turn calls the correct callback.
    /// </summary>

    static void AddSibling(object obj)
    {
        AddFunc  func   = obj as AddFunc;
        UIWidget widget = func(Selection.activeTransform.parent.gameObject);

        if (widget != null)
        {
            Selection.activeGameObject = widget.gameObject;
        }
    }
Beispiel #11
0
    /// <summary>
    /// Wrapper function called by the menu that in turn calls the correct callback.
    /// </summary>

    static void AddChild(object obj)
    {
        AddFunc  func   = obj as AddFunc;
        UIWidget widget = func(Selection.activeGameObject);

        if (widget != null)
        {
            Selection.activeGameObject = widget.gameObject;
        }
    }
Beispiel #12
0
        private void Strip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var strip = (ContextMenuStrip)sender;

            strip.Close();
            var tree = this.tv_menu.SelectedNode;//当前选择树节点

            if (tree == null)
            {
                MessageBox.Show("没选到树节点");
                return;
            }
            var code = tree.Tag;//功能对应的菜单code
            //获取选中的数据
            var selected = this.dgv_funclist.SelectedRows;

            if (selected.Count == 0)
            {
                return;
            }
            var row      = selected[0];
            var id       = row.Cells[0].Value;
            var codeName = row.Cells[3].Value.ToString();

            AddFunc func = null;

            switch (e.ClickedItem.Text)
            {
            case "修改":
                func = new AddFunc(Convert.ToDecimal(id));
                break;

            case "删除":
                //if (codeName == "Read")
                //{
                //    MessageBox.Show("系统功能,禁止操作");
                //    return;
                //}
                RemoveFunc(id);
                break;

            case "查看":
                func = new AddFunc(Convert.ToDecimal(id), true);
                break;

            default:
                break;
            }
            if (func != null)
            {
                func.StartPosition = FormStartPosition.CenterScreen;
                var result = func.ShowDialog();
            }
            LoadFuncList(code);
        }
Beispiel #13
0
        private bool PerformValidation()
        {
            bool result = true;

            if (dto.Worker_detail.Where(x => x.Employee_Id == Convert.ToInt16(cbEmployee.SelectedValue.ToString())).ToList().Count > 0)
            {
                AddFunc.MsgError("Employee Already Added");
                result = false;
            }
            return(result);
        }
Beispiel #14
0
 private void updateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (RowIndex > -1)
     {
         CopyBL2GUI();
         _FormMode = FormMode.Update;
     }
     else
     {
         AddFunc.MsgError("No Row Selected!");
     }
 }
Beispiel #15
0
        private bool PerformValidation()
        {
            bool   Result = true;
            string message;

            message = AddFunc.CheckControlTextBoxStringEmpty(txtNewPasswd, txtoldPasswd, txtRePasswd, txtUsername);
            if (message != string.Empty)
            {
                AddFunc.MsgError(message);
                Result = false;
            }
            return(Result);
        }
        private bool PerformValidation()
        {
            bool   Result   = true;
            string message  = AddFunc.CheckControlTextBoxStringEmpty(txtAlamat, txtBornDate, txtDescription, txtEmail, txtName, txtNoBatch);
            string messages = AddFunc.CheckComboBoxValue(LstDepartment, Position);

            if (message != string.Empty)
            {
                AddFunc.MsgError(message);
                Result = false;
            }

            return(Result);
        }
Beispiel #17
0
        private void ShowLogin()
        {
            FrmLogin     form = new FrmLogin();
            DialogResult dr   = form.ShowDialog();

            if (dr != DialogResult.OK)
            {
                this.Close();
            }
            else
            {
                AddFunc.MsgInfo("Login Succesfull");
            }
        }
Beispiel #18
0
 private void FrnMain_Load(object sender, EventArgs e)
 {
     try
     {
         this.Left   = this.Top = 0;
         this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
         this.Height = Screen.PrimaryScreen.WorkingArea.Height;
         Screen screen = AddFunc.GetSecondaryScreen();
         //this.Location = screen.WorkingArea.Location;
         //this.Size = new Size(screen.WorkingArea.Width, screen.WorkingArea.Height);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (RowIndex > -1)
     {
         if (AddFunc.MsgQuesYESNO("Are sure want to delete this record ?"))
         {
             Employee.DeleteEmployee(dgResult.Rows[RowIndex].Cells["Id"].Value.ToString());
             AddFunc.MsgInfo("Data Delete Succesful");
             RefresDG();
         }
     }
     else
     {
         AddFunc.MsgError("No Row Detected!");
     }
 }
Beispiel #20
0
        private bool PerformValidation()
        {
            bool   result  = true;
            string message = AddFunc.CheckControlTextBoxStringEmpty(txtBPMobil, txtCustomer, txtMobil);

            if (message != string.Empty)
            {
                AddFunc.MsgError(message);
                result = false;
            }
            if (_obj.Invoice_Detail.Where(x => x.Service_Name == cbPackages.Text).Count() > 0)
            {
                AddFunc.MsgError("This Package Already Add !");
                result = false;
            }
            return(result);
        }
Beispiel #21
0
        private bool PerformValidation()
        {
            bool   result = true;
            string message;

            message = AddFunc.CheckControlTextBoxStringEmpty(txtPackageNames);
            if (message != string.Empty)
            {
                AddFunc.MsgError(message);
                result = false;
            }
            message = AddFunc.CheckNumericZero(nmrPrice);
            if (message != string.Empty)
            {
                AddFunc.MsgError(message);
                result = false;
            }
            return(result);
        }
 private void tvUserGroupRoles_AfterCheck(object sender, TreeViewEventArgs e)
 {
     try
     {
         if (e.Action != TreeViewAction.Unknown)
         {
             if (e.Node.Checked)
             {
                 if (lboUser.Items.Count > 0)
                 {
                     usergrouproles             = listusergrouproles.FirstOrDefault(x => x.MenuPath == e.Node.FullPath && x.UserId == lboUser.SelectedItem.ToString());
                     usergrouproles.ObjectState = usergrouproles.ObjectState == EntityState.None ? EntityState.Update : usergrouproles.ObjectState;
                     usergrouproles.Permission  = e.Node.Checked;
                     if (e.Node.Parent != null)
                     {
                         usergrouproles             = listusergrouproles.FirstOrDefault(x => x.MenuPath == e.Node.Parent.FullPath && x.UserId == lboUser.SelectedItem.ToString());
                         usergrouproles.ObjectState = usergrouproles.ObjectState == EntityState.None ? EntityState.Update : usergrouproles.ObjectState;
                         usergrouproles.Permission  = e.Node.Parent.Checked = e.Node.Checked;
                     }
                 }
                 else
                 {
                     e.Node.Checked = false;
                     MessageBox.Show("Please register a user for your selected user group !");
                 }
             }
             else
             {
                 usergrouproles             = listusergrouproles.FirstOrDefault(x => x.MenuPath == e.Node.FullPath && x.UserId == lboUser.SelectedItem.ToString());
                 usergrouproles.ObjectState = usergrouproles.ObjectState == EntityState.None ? EntityState.Update : usergrouproles.ObjectState;
                 usergrouproles.Permission  = false;
                 AddRecursiveNode(e.Node, false, lboUser.SelectedItem.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         AddFunc.MsgError(ex.Message);
     }
 }
Beispiel #23
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (PerfomValidation())
         {
             if (_form == FormMode.New)
             {
                 CopyGUI2BL();
                 CWUser.AddCWUser(obj);
                 AddFunc.MsgInfo("Add User Succesfull");
             }
             else if (_form == FormMode.Update)
             {
             }
             _form = FormMode.View;
             SetupFormMode();
         }
     }catch (Exception ex) {
         AddFunc.MsgError(ex.Message);
     }
 }
Beispiel #24
0
 private void btnProcess_Click(object sender, EventArgs e)
 {
     try {
         if (dgResult.Rows.Count > 0)
         {
             if (AddFunc.MsgQuesYESNO("Are you sure want to process this invoices ?"))
             {
                 _obj.CustomerName = txtCustomer.Text;
                 Invoices.AddInvoice(_obj);
                 AddFunc.MsgInfo("Thank For You Order");
             }
         }
         else
         {
             AddFunc.MsgError("No Package added !");
         }
     }
     catch (Exception ex)
     {
         AddFunc.MsgError(ex.Message);
     }
 }
Beispiel #25
0
        private void RefreshDG()
        {
            var source = new BindingSource();

            source.DataSource            = _obj.Invoice_Detail;
            dgResult.DataSource          = source;
            dgResult                     = AddFunc.HideSpecificColoum(dgResult, "ID", "INVOICE_ID");
            dgResult.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            Amount = _obj.Invoice_Detail.Sum(item => item.Price);
            if (Amount > 1000000)
            {
                _obj.Discount = Amount * 10 / 100;
                Amount        = Amount * 90 / 100;
                AddFunc.MsgInfo("You Got a discount");
            }
            else
            {
                _obj.Discount = 0;
                Amount        = _obj.Invoice_Detail.Sum(item => item.Price);
            }
            lblPrice.Text = Amount.ToString();
            Dto           = new Invoice_DetailDTO();
        }
Beispiel #26
0
        /// <summary>
        /// Adds or updates a specific value.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        private object AddOrUpdate(string[] key, int position, AddFunc addFunc, UpdateFunc updateFunc)
        {
            if (position >= key.Length)
            {
                lock (this)
                {
                    // There's already a value
                    if (this.Value != default(object))
                    {
                        return(updateFunc(this.Value));
                    }

                    // No value, add it
                    this.Value = addFunc();
                    return(this.Value);
                }
            }

            // Create a child
            var child = Utils.GetOrAddToHashtable(Children, key[position], new ReverseTrie((short)position)) as ReverseTrie;

            return(child.AddOrUpdate(key, position + 1, addFunc, updateFunc));
        }
Beispiel #27
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try {
         if (PerformValidation())
         {
             if (_FormMode == FormMode.New)
             {
                 Packages.AddPackages(txtPackageNames.Text, nmrPrice.Value);
                 AddFunc.MsgInfo("Packages Add Succesful");
             }
             else if (_FormMode == FormMode.Update)
             {
                 Packages.EditPackages(Id, txtPackageNames.Text, nmrPrice.Value);
                 AddFunc.MsgInfo("Packages Edit Succesful");
                 _FormMode = FormMode.New;
             }
             RefreshDG();
         }
     }
     catch (Exception ex)
     {
         AddFunc.MsgError(ex.Message);
     }
 }
Beispiel #28
0
        private bool PerfomValidation()
        {
            bool   result  = true;
            String message = AddFunc.CheckComboBoxValue(cboEmployee, cboUserGroup);

            if (message != string.Empty)
            {
                AddFunc.MsgWarning(message);
                return(false);
            }
            message = AddFunc.CheckControlTextBoxStringEmpty(txtPassword, txtReTypePass, txtUsername);
            if (message != string.Empty)
            {
                AddFunc.MsgWarning(message);
                return(false);
            }
            if (txtPassword.Text != txtReTypePass.Text)
            {
                AddFunc.MsgWarning("Password wasn't match");
                return(false);
            }

            return(result);
        }
Beispiel #29
0
        /// <summary>
        /// 动态右键菜单,选择菜单之后执行对应功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NewStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var now = (ContextMenuStrip)sender;

            now.Close();
            var node = this.tv_menu.SelectedNode;

            if (node == null)
            {
                MessageBox.Show("请选择菜单");
                return;
            }
            var stripText  = e.ClickedItem.Text.GetEunmInDesciption(typeof(NodeMenu));
            var descrition = node.Text; //描述
            var code       = node.Tag;  //code编码
            var codeParent = node.Name; //父级编号
            Add add        = null;
            var _code      = code == null ? null : code.ToString();

            switch ((NodeMenu)stripText)
            {
            case NodeMenu.addchildren:
                add = new Add(_code, NodeMenu.addchildren);
                break;

            case NodeMenu.update:
                add = new Add(_code);
                break;

            case NodeMenu.remove:
                Remove(code);
                break;

            case NodeMenu.add:
                add = new Add(codeParent == null ? null : codeParent.ToString(), NodeMenu.add);
                break;

            case NodeMenu.addFunc:
                AddFunc addFunc = new AddFunc(_code);
                addFunc.StartPosition = FormStartPosition.CenterScreen;
                var result = addFunc.ShowDialog();
                addFunc.Dispose();
                break;

            case NodeMenu.initFunc:
                MenuStripFactory.InItFunc(_code);
                MessageBox.Show("操作成功");
                break;

            default:
                break;
            }
            if (add != null)
            {
                add.StartPosition = FormStartPosition.CenterScreen;
                var result = add.ShowDialog();
                add.Dispose();
            }
            LoadTree();
            LoadMenuList(code);
            this.tv_menu.SelectedNode = node;
        }
 public static void LoadFiles(AddFunc addFunc)
 {
 }
Beispiel #31
0
 static public void LoadFiles(AddFunc addFunc)
 {
 }