Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int        roleid   = Convert.ToInt32(rblRole.SelectedValue);
            int        masterid = Convert.ToInt32(Request.QueryString["MasterId"].ToString());
            MasterInfo master   = new MasterInfo(masterid);

            if (rblIsOver.SelectedItem.Text == "通过")
            {
                master.State = 2;
                master.Save();
                try
                {
                    //添加角色
                    if (RoleInfo.isRoleMaster(masterid))
                    {
                        RoleInfo.UpdateRoleMasters(masterid);
                    }
                    else
                    {
                        RoleMasterInfo rm = new RoleMasterInfo();
                        rm.RoleId   = roleid;
                        rm.MasterId = masterid;
                        rm.IsPass   = 1;
                        rm.Save();
                    }
                    //添加权限
                    if (RoleInfo.isActionMaster(masterid))
                    {
                        RoleInfo.DelActionMaster(masterid);
                        AddActionMaster(masterid);
                    }
                    else
                    {
                        AddActionMaster(masterid);
                    }
                    master.IsApply = 1;
                    master.Save();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('权限配置成功!');</script>");
                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('配置失败:" + Ex.Message + "');", true);
                }
            }
            else
            {
                master.State = 3;
                master.Save();
            }
        }
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            if (!IsValid) {
                (Master as Dreadnought_Master).Message("Please make sure the form is valid.");
                return;
            }

            MasterInfo masterInfo = new MasterInfo(txtMaster.Text);

            if (masterInfo.Exists) {
                (Master as Dreadnought_Master).Message("This master already exists (<a href=\"EditMaster.aspx?Master=" + masterInfo.RelativePath + "\">Edit it</a>).");
                return;
            }

            try {
                masterInfo.Save();
            } catch (Dreadnought.InvalidDirectoryException) {
                (Master as Dreadnought_Master).Message("You cannot create a master in the directory '" + masterInfo.RelativeDirectory + "'.");
                return;
            } catch {
                (Master as Dreadnought_Master).Message("An unexpected error occurred. Please make sure you have sufficent user rights.");
                return;
            }

            if (chkRedirect.Checked)
                Response.Redirect("EditMaster.aspx?Master=" + masterInfo.RelativePath);
        }
Ejemplo n.º 3
0
 protected void btnAddUser_Click(object sender, EventArgs e)
 {
     if (IsPageValid())
     {
         string strName = txtUserName.Text.ToString();
         bool   isexit  = MasterInfo.IsUserExit(strName);
         if (!isexit)
         {
             try
             {
                 MasterInfo master = new MasterInfo();
                 master.MasterName = txtUserName.Text.ToString();
                 master.MasterPsd  = txtNewPsd.Text.ToString();
                 master.DepartId   = Convert.ToInt32(ddlDepart.SelectedValue.ToString());
                 DateTime time = DateTime.Now;
                 master.CreateDate = time;
                 master.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue.ToString());
                 master.State      = 0;
                 master.IsApply    = 0;
                 master.Save();
                 FileEmployee();
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('添加成功!');</script>");
             }
             catch (Exception Ex)
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('更新失败:" + Ex.Message + "');", true);
             }
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('用户名已存在,请重新添加!');</script>");
         }
     }
 }
Ejemplo n.º 4
0
        private void txtSave_Click(object sender, EventArgs e)
        {
            MasterInfo master = lsMasters.SelectedItem as MasterInfo;

            if (master != null)
            {
                master.SheJi      = short.Parse(txtSheJi.Text);
                master.GeDou      = short.Parse(txtGeDou.Text);
                master.ShouBei    = short.Parse(txtShouBei.Text);
                master.FanYin     = short.Parse(txtFanYin.Text);
                master.JueXin     = short.Parse(txtJueXin.Text);
                master.ZhiHui     = short.Parse(txtZhiHui.Text);
                master.FuZuo      = short.Parse(txtFuZuo.Text);
                master.TongXun    = short.Parse(txtTongXun.Text);
                master.CaoDuo     = short.Parse(txtCaoDuo.Text);
                master.WeiXiu     = short.Parse(txtWeiXiu.Text);
                master.MeiLi      = short.Parse(txtMeiLi.Text);
                master.JinYan     = short.Parse(txtJinYan.Text);
                master.ChengZhang = short.Parse(cboGrown.SelectedValue.ToString());

                try
                {
                    master.GuYou1 = short.Parse(cboGuYou1.SelectedValue.ToString());
                }
                catch
                {
                    MessageBox.Show("固有技能1编号未知,已使用原始能力" + master.GuYou1);
                }
                try
                {
                    master.GuYou2 = short.Parse(cboGuYou2.SelectedValue.ToString());
                }
                catch
                {
                    MessageBox.Show("固有技能2编号未知,已使用原始能力" + master.GuYou2);
                }
                try
                {
                    master.GuYou3 = short.Parse(cboGuYou3.SelectedValue.ToString());
                }
                catch
                {
                    MessageBox.Show("固有技能3编号未知,已使用原始能力" + master.GuYou3);
                }

                master.Last4 = short.Parse(cboLast4.SelectedValue.ToString());

                master.Save();

                master.Refresh();
                LoadData(master);

                tsmiLblState.Text      = "保存成功";
                tsmiLblState.ForeColor = Color.Green;
            }
        }
Ejemplo n.º 5
0
        protected void gvMaster_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            int     masterid      = Convert.ToInt32(gvMaster.DataKeys[e.RowIndex].Value);
            TextBox txtMasterName = gvMaster.Rows[e.RowIndex].FindControl("txtMasterName") as TextBox;

            try
            {
                MasterInfo master = new MasterInfo(masterid);
                master.MasterName = txtMasterName.Text.ToString();
                master.Save();
                gvMaster.EditIndex = -1;
                gvDataBind();
            }
            catch (Exception Ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('更新失败:" + Ex.Message + "');", true);
            }
        }
Ejemplo n.º 6
0
        private void btnImportBatch_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            //dialog.RestoreDirectory = true;
            dialog.Filter      = "人物数据|*.master";
            dialog.Multiselect = true;

            if (dialog.ShowDialog() == DialogResult.OK && dialog.FileNames.Length > 0)
            {
                txtSearch.Text = null;

                foreach (string fileName in dialog.FileNames)
                {
                    byte[] data = File.ReadAllBytes(fileName);

                    byte[] bt = new byte[GGCRStaticConfig.MasterUIDLength];
                    Array.Copy(data, 0, bt, 0, bt.Length);
                    string uid = ByteHelper.ByteArrayToHexString(bt).Trim();

                    MasterInfo select = null;
                    foreach (MasterInfo info in masters)
                    {
                        if (info.UUID == uid)
                        {
                            select = info;
                            break;
                        }
                    }
                    if (select != null)
                    {
                        select.Replace(data);
                        select.Save();
                    }
                }

                lsMasters.SelectedItem = null;

                bindAll();

                MessageBox.Show("导入成功,已自动保存", "操作提示");
                // lsGundam.SelectedIndex = 0;
            }
        }