Пример #1
0
    }//end InsertCancelButton_Click


    /// <summary>
    /// 由新增模式,確認新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        int AddRecord = 0;
        try
        {
            #region 取得畫面元件的值

            string v_Code = ((WUI.SLP.SLPUnique)FormView1.FindControl("TextBoxCode")).Text.Trim();
            string v_Name = ((TextBox)FormView1.FindControl("TextBoxName")).Text.Trim();
            string v_Description = ((TextBox)FormView1.FindControl("TextBoxDescription")).Text.Trim();
            DateTime processtime = DateTime.Now;
            string v_SystemCode = ((TextBox)FormView1.FindControl("TextBoxSystemCode")).Text.Trim();
            string v_ParentCode = ((WUI.SLP.Program)this.FormView1.FindControl("TextBoxParentCode")).Text;
            string v_LinkUrl = ((TextBox)FormView1.FindControl("TextBoxLinkURL")).Text.Trim();
            string v_DisplayOrder = ((WUI.SLP.SLPQuantity)this.FormView1.FindControl("TextBoxDisplayOrder")).Text;
            string v_ProgramType = ((WUI.SLP.SLPENVProgramType)this.FormView1.FindControl("TextBoxProgramType")).Text;

            ParameterList.Clear();
            SYSModel.MaintainProgram Uniq = new SYSModel.MaintainProgram(ConnectionDB);
            ParameterList.Add(v_Code);
            ParameterList.Add("SYS_PROGRAM");
            ParameterList.Add("CODE");
            ParameterList.Add("");
            DataTable Dup = Uniq.QuerySwitch(SYSModel.MaintainProgram.QueryType.Duplicate,
                                         ParameterList
                                         );
            if (Dup.Rows.Count > 0)
            {
                if (Dup.Rows[0]["ENABLE"].ToString() == "1")
                {
                    throw new Exception("資料重覆!");
                }
            }
            #endregion

            #region 加入輸入條件

            ParameterList.Clear();

            ParameterList.Add(v_Code);
            ParameterList.Add(v_Name);
            ParameterList.Add(v_Description);
            ParameterList.Add(processtime);               //vCreateDate
            ParameterList.Add(Session["UID"].ToString()); //vCreateUID
            ParameterList.Add(processtime);               //vUpdateDate
            ParameterList.Add(Session["UID"].ToString()); //vUpdateUID
            ParameterList.Add(v_SystemCode);
            ParameterList.Add(v_ParentCode);
            ParameterList.Add(v_LinkUrl);
            if (v_DisplayOrder != "")
            { ParameterList.Add(int.Parse(v_DisplayOrder));}
            else
            { ParameterList.Add(0);}

            if (v_ProgramType != "")
            { ParameterList.Add(int.Parse(v_ProgramType));}
            else
            { ParameterList.Add(0);}

            #endregion

            SYSModel.MaintainProgram BCO = new SYSModel.MaintainProgram(ConnectionDB);
            AddRecord = BCO.CreateProgram(ParameterList, null);

            if (AddRecord == 0)
            {
                throw new Exception("新增0筆資料!");
            }
            else
            {
                Response.Write("<script>alert('新增完成');location.replace('SYS062.aspx?mode=readonly&ID=" + AddRecord + "');</script>");
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

    }
Пример #2
0
    }//end InsertCancelButton_Click


    /// <summary>
    /// 由新增模式,確認新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        int AddRecord = 0;
        try
        {
            #region 取得畫面元件的值

            string v_Code = ((WUI.SLP.SLPUnique)FormView1.FindControl("TextBoxCode")).Text.Trim();          
            string v_Name = ((TextBox)FormView1.FindControl("TextBoxName")).Text.Trim();           
            DateTime processtime = DateTime.Now;
            string v_Model = ((TextBox)FormView1.FindControl("TextBoxModel")).Text.Trim();
            string v_Description = ((TextBox)FormView1.FindControl("TextBoxDescription")).Text.Trim();
            string v_Weburl = ((TextBox)FormView1.FindControl("TextBoxWebURL")).Text.Trim();
            string v_Mstid = ((TextBox)FormView1.FindControl("TextBoxMstIDSerialNext")).Text.Trim();

            ParameterList.Clear();
            SYSModel.MaintainProgram Uniq = new SYSModel.MaintainProgram(ConnectionDB);
            ParameterList.Add(v_Code);
            ParameterList.Add("SYS_BusMasterMeta");
            ParameterList.Add("CODE");
            ParameterList.Add("");
            DataTable Dup = Uniq.QuerySwitch(SYSModel.MaintainProgram.QueryType.Duplicate,
                                         ParameterList
                                         );
            if (Dup.Rows.Count > 0)
            {
                if (Dup.Rows[0]["ENABLE"].ToString() == "1")
                {
                    throw new Exception("資料重覆!");
                }
            }

            #endregion

            #region 加入輸入條件

            ParameterList.Clear();

            ParameterList.Add(v_Code);
            ParameterList.Add(v_Name);
            ParameterList.Add(processtime);               //vCreateDate
            ParameterList.Add(Session["UID"].ToString()); //vCreateUID
            ParameterList.Add(processtime);               //vUpdateDate
            ParameterList.Add(Session["UID"].ToString()); //vUpdateUID
            ParameterList.Add(v_Model);
            ParameterList.Add(v_Description);
            ParameterList.Add(v_Weburl);
            if (v_Mstid != "")
            {
                ParameterList.Add(Decimal.Parse(v_Mstid));
            }
            else
            {
                ParameterList.Add(0);
            }

            #endregion

            SYSModel.MaintainBusMasterMeta BCO = new SYSModel.MaintainBusMasterMeta(ConnectionDB);
            AddRecord = BCO.CreateBusMasterMeta(ParameterList, null);

            if (AddRecord == 0)
            {
                throw new Exception("新增0筆資料!");
            }
            else
            {
                Response.Write("<script>alert('新增完成');location.replace('SYS102.aspx?mode=readonly&ID=" + AddRecord + "');</script>");
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

    }
Пример #3
0
    /// <summary>
    /// 繫結資料
    /// </summary>
    /// <param name=VirtualDataID></param>
    private void databind(FormViewMode fvm)
    {
        try
        {
            SYSModel.MaintainProgram BCO = new SYSModel.MaintainProgram(ConnectionDB);

            ParameterList.Clear();
            if (Request["ID"] != null)
                ParameterList.Add(Request["ID"].ToString());
            else
                ParameterList.Add("0");


           dt_Result = BCO.QuerySwitch(SYSModel.MaintainProgram.QueryType.ID,
                                           ParameterList
                                           );

           if (dt_Result.Rows.Count > 0)
           {

               this.hiddenID.Value = dt_Result.Rows[0]["ID"].ToString();
               FormView1.DataSource = dt_Result;
               FormView1.DataBind();
           }

            AuthorityControls(this);

            //ToolBarStatus
            switch (fvm)
            {
                case FormViewMode.Edit:
                    //修改All換為空值
                    DropDownList D2 = ((DropDownList)this.FormView1.FindControl("TextBoxProgramType").FindControl("D1"));
                    D2.Items.RemoveAt(0);
                    TextBox edit_txtname = ((TextBox)this.FormView1.FindControl("TextBoxCode").FindControl("TextBoxName"));
                    edit_txtname.Visible = false;

                    ToolBarStatus("edit");                 
                    break;
                case FormViewMode.Insert:
                    GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.NewEdit;                   
                    ToolBarStatus("insert");
                    break;
                case FormViewMode.ReadOnly:
                    //修改All換為空值
                    DropDownList D3 = ((DropDownList)this.FormView1.FindControl("TextBoxProgramType").FindControl("D1"));
                    D3.Items[0].Text = "";
                    TextBox txtname = ((TextBox)this.FormView1.FindControl("TextBoxCode").FindControl("TextBoxName"));
                    txtname.Visible = false;

                    ToolBarStatus("readonly");
                    break;
            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

    }//databind
Пример #4
0
    }//end InsertCancelButton_Click


    /// <summary>
    /// 由新增模式,確認新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        int AddRecord = 0;
        try
        {
            #region 取得畫面元件的值
            string v_Name = "";
            string v_Memo = "";
            string v_Code = ((WUI.SLP.SLPUnique)FormView1.FindControl("TextBoxCode")).Text.Trim();
            if (FormView1.FindControl("TextBoxName") != null)
            {
                v_Name = ((TextBox)FormView1.FindControl("TextBoxName")).Text.Trim();
            }

            DateTime processtime = DateTime.Now;
            if (FormView1.FindControl("TextBoxMemo") != null)
            {
                v_Memo = ((TextBox)FormView1.FindControl("TextBoxMemo")).Text.Trim();
            }

            ParameterList.Clear();
            SYSModel.MaintainProgram Uniq = new SYSModel.MaintainProgram(ConnectionDB);
            ParameterList.Add(v_Code);
            ParameterList.Add("SYS_ROLE");
            ParameterList.Add("CODE");
            ParameterList.Add("");
            DataTable Dup = Uniq.QuerySwitch(SYSModel.MaintainProgram.QueryType.Duplicate,
                                         ParameterList
                                         );
            if (Dup.Rows.Count > 0)
            {
                if (Dup.Rows[0]["ENABLE"].ToString() == "1")
                {
                    throw new Exception("資料重覆!");
                }
            }
            #endregion

            #region 加入輸入條件

            ParameterList.Clear();

            ParameterList.Add(v_Code);
            ParameterList.Add(v_Name);
            ParameterList.Add(processtime);               //vCreateDate
            ParameterList.Add(Session["UID"].ToString()); //vCreateUID
            ParameterList.Add(processtime);               //vUpdateDate
            ParameterList.Add(Session["UID"].ToString()); //vUpdateUID
            ParameterList.Add(v_Memo);

            #endregion

            SYSModel.MaintainRole BCO = new SYSModel.MaintainRole(ConnectionDB);
            AddRecord = BCO.CreateRole(ParameterList, null);

            if (AddRecord == 0)
            {
                throw new Exception("新增0筆資料!");
            }
            else
            {
                Response.Write("<script>alert('新增完成');location.replace('SYS032.aspx?mode=readonly&ID=" + AddRecord + "');</script>");
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

    }
Пример #5
0
        }//RaiseCallbackEvent

        #endregion ICallbackEventHandler 實作成員


        private void dataget()
        {
            if (_TableName == "") { return; }
            if (_ColumnName == "") { return; }

            if (_Code == OrgText) 
            {
                _Name = "OK"; 
            }
            else
            {
                ParameterList.Clear();
                SYSModel.MaintainProgram BCO = new SYSModel.MaintainProgram(ConntionDB);
                ParameterList.Add(_Code);
                ParameterList.Add(TableName);
                ParameterList.Add(ColumnName);
                if (ColumnName == "SCODE")//PS:請註明原因
                {
                    //string Category = ((TextBox)this.Parent.FindControl("TextBoxCode")).Text.Trim();
                    ParameterList.Add(Category);
                }
                else
                {
                    ParameterList.Add("");
                }

                DataTable Dt = BCO.QuerySwitch(SYSModel.MaintainProgram.QueryType.Duplicate,
                                          ParameterList
                                          );

                if (Dt.Rows.Count > 0)
                {
                    if (Dt.Rows[0]["ENABLE"].ToString() == "1")//刪除時Eanble=0 還是存在 
                    {
                        _Name = "資料重覆";
                    }
                    else
                    {
                        _Name = "查無資料";
                    }
                }
                else
                {
                    _Name = "查無資料";
                }
            }
            TextBoxName.Text = _Name;

        }//dataget
Пример #6
0
    }//end InsertCancelButton_Click


    /// <summary>
    /// 由新增模式,確認新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        ErrorMsgLabel.Text = "";
        int AddRecord = 0;
        try
        {
            #region 取得畫面元件的值
            DateTime processtime = DateTime.Now;
            string v_UserCode = ((WUI.SLP.User)this.FormView1.FindControl("TextBoxUserCode")).Text;
            string v_RoleCode = ((WUI.SLP.Role)this.FormView1.FindControl("TextBoxRoleCode")).Text;

            //TextBox rolename = ((TextBox)this.FormView1.FindControl("TextBoxRoleCode").FindControl("TextBoxName"));
            string v_RoleName = "";

            SYSModel.MaintainUser BCO1 = new SYSModel.MaintainUser(ConnectionDB);
            ParameterList.Clear();
            ParameterList.Add(v_UserCode);
            DataTable Chkuser = BCO1.QueryUserByCode(ParameterList);
            if (Chkuser.Rows.Count != 1)
            {
                ErrorMsgLabel.Text = "請輸入正確人員代號";
                return;
            }

            SYSModel.MaintainRole BCO2 = new SYSModel.MaintainRole(ConnectionDB);
            ParameterList.Clear();
            ParameterList.Add(v_RoleCode);
            DataTable Chkrole = BCO2.QueryRoleByCode(ParameterList);
            if (Chkrole.Rows.Count != 1)
            {
                ErrorMsgLabel.Text = "請輸入正確角色代號";
                return;
            }
            else
            {
                v_RoleName = Chkrole.Rows[0]["NAME"].ToString();
            }

            ParameterList.Clear();
            SYSModel.MaintainProgram Uniq = new SYSModel.MaintainProgram(ConnectionDB);
            ParameterList.Add(v_UserCode);
            ParameterList.Add("SYS_USERROLEREL");
            ParameterList.Add("USERCODE");
            ParameterList.Add("");
            DataTable Dup = Uniq.QuerySwitch(SYSModel.MaintainProgram.QueryType.Duplicate,
                                         ParameterList
                                         );
            if (Dup.Rows.Count > 0)
            {
                if (Dup.Rows[0]["ENABLE"].ToString() == "1")
                {
                    throw new Exception("人員已存在角色關連!");
                }
            }
            #endregion

            #region 加入輸入條件

            ParameterList.Clear();

            ParameterList.Add("");//ParameterList.Add(v_Code);
            ParameterList.Add(v_RoleName);//ParameterList.Add(v_Name);
            ParameterList.Add(processtime); //vCreateDate
            ParameterList.Add(Session["UID"].ToString()); //vCreateUID
            ParameterList.Add(processtime); //vUpdateDate
            ParameterList.Add(Session["UID"].ToString()); //vUpdateUID
            ParameterList.Add(v_UserCode);
            ParameterList.Add(v_RoleCode);

            #endregion

            SYSModel.MaintainUserRoleRel BCO = new SYSModel.MaintainUserRoleRel(ConnectionDB);
            AddRecord = BCO.CreateUserRoleRel(ParameterList, null);

            if (AddRecord == 0)
            {
                throw new Exception("新增0筆資料!");
            }
            else
            {
                Response.Write("<script>alert('新增完成');location.replace('SYS052.aspx?mode=readonly&ID=" + AddRecord + "');</script>");
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

    }
Пример #7
0
    public string UniqueName(string Code,
                             string TableName,
                             string ColumnName,
                             string Category,
                             string OrgText
                             )
    {
        string Name = "";
        string ConnectionDBStr = ((DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration")).DefaultDatabase;        

        if ((TableName != "") && (ColumnName != ""))
        {
            if (Code != "")
            {
                if (Code == OrgText)
                {
                    Name = "OK";
                }
                else
                {
                    MaintainProgram BCO = new MaintainProgram(ConnectionDBStr);

                    ArrayList ParameterList = new ArrayList();

                    ParameterList.Clear();
                    ParameterList.Add(Code);
                    ParameterList.Add(TableName);
                    ParameterList.Add(ColumnName);

                    if (ColumnName == "SCODE")
                    {
                        ParameterList.Add(Category);
                    }
                    else
                    {
                        ParameterList.Add("");
                    }

                    DataTable Dt = BCO.QuerySwitch(MaintainProgram.QueryType.Duplicate,
                                                   ParameterList
                                                   );

                    if (Dt.Rows.Count > 0)
                    {
                        if (Dt.Rows[0]["ENABLE"].ToString() == "1")//刪除時Eanble=0 還是存在 
                        {
                            Name = "資料重覆";
                        }
                        else
                        {
                            Name = "查無資料";
                        }
                    }
                    else
                    {
                        Name = "查無資料";
                    }
                }
            }
        }


        return Name;
    }
Пример #8
0
    }//end InsertCancelButton_Click


    /// <summary>
    /// 由新增模式,確認新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        try
        {
            int AddRecord = 0;
            ErrorMsgLabel.Text = "";

            #region 取得畫面元件的值

            string v_Code = ((WUI.SLP.SLPUnique)FormView1.FindControl("TextBoxCode")).Text.Trim();
            string v_Name = ((TextBox)FormView1.FindControl("TextBoxName")).Text.Trim();
            DateTime processtime = DateTime.Now;
            //string v_Organizationcode = ((WUI.SLP.Organization)FormView1.FindControl("TextBoxOrganizationCode")).Text.Trim();
            string v_Password = ((TextBox)FormView1.FindControl("TextBoxPassword")).Text.Trim();
            string v_Memo = ((TextBox)FormView1.FindControl("TextBoxMemo")).Text.Trim();

            if (v_Password.Length < 8)
                throw new Exception("密碼長度不足8碼!");

            //密碼加密
            SYSModel.CryptographyHelper Cry = new SYSModel.CryptographyHelper();
            string CryPassword = Cry.Encrypt(v_Password);

            ParameterList.Clear();
            SYSModel.MaintainProgram Uniq = new SYSModel.MaintainProgram(ConnectionDB);
            ParameterList.Add(v_Code);
            ParameterList.Add("SYS_USER");
            ParameterList.Add("CODE");
            ParameterList.Add("");
            DataTable Dup = Uniq.QuerySwitch(SYSModel.MaintainProgram.QueryType.Duplicate,
                                         ParameterList
                                         );
            if (Dup.Rows.Count > 0)
            {
                if (Dup.Rows[0]["ENABLE"].ToString() == "1")
                {
                    throw new Exception("資料重覆!");
                }
            }
            #endregion

            #region 加入輸入條件

            ParameterList.Clear();

            ParameterList.Add(v_Code);
            ParameterList.Add(v_Name);
            ParameterList.Add(processtime);               //vCreateDate
            ParameterList.Add(Session["UID"].ToString()); //vCreateUID
            ParameterList.Add(processtime);               //vUpdateDate
            ParameterList.Add(Session["UID"].ToString()); //vUpdateUID
            //ParameterList.Add(v_Organizationcode);
            ParameterList.Add(CryPassword);
            ParameterList.Add(v_Memo);

            #endregion

            SYSModel.MaintainUser BCO = new SYSModel.MaintainUser(ConnectionDB);
            AddRecord = BCO.CreateUser(ParameterList, null);

            if (AddRecord == 0)
            {
                throw new Exception("新增0筆資料!");
            }
            else
            {
                LogHelper LOG = new LogHelper(ConnectionDB);
                ParameterList.Clear();
                ParameterList.Add("SYS04人員");//0
                ParameterList.Add(Session["UID"].ToString());//1
                ParameterList.Add("I");//2
                ParameterList.Add(v_Code);//3
                ParameterList.Add(Request.ServerVariables["Server_Name"]);//4

                LOG.AddSafeLog(ParameterList);
                Response.Write("<script>alert('新增完成');location.replace('SYS042.aspx?mode=readonly&ID=" + AddRecord + "');</script>");
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

    }