private void OnStart()
        {

            InputData();
            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    HiddenDisp();
                    TopTr.Visible = false;
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    HiddenDisp();
                    HeadMenuButtonItem Bm0 = new HeadMenuButtonItem();
                    Bm0.ButtonPopedom = PopedomType.List;
                    Bm0.ButtonUrl = string.Format("?CMD=Look&S_ID={0}", S_ID);
                    Bm0.ButtonIcon = "back.gif";
                    Bm0.ButtonName = "返回";
                    HeadMenuWebControls1.ButtonList.Add(Bm0);
                    HeadMenuButtonItem Bm1 = new HeadMenuButtonItem();
                    Bm1.ButtonPopedom = PopedomType.Delete;
                    Bm1.ButtonUrlType = UrlType.JavaScript;
                    Bm1.ButtonUrl = string.Format("DelData('?CMD=Delete&S_ID={0}')", S_ID);
                    HeadMenuWebControls1.ButtonList.Add(Bm1);
                    break;
                case "Look":
                    HiddenInput();
                    HeadMenuButtonItem Bm2 = new HeadMenuButtonItem();
                    Bm2.ButtonPopedom = PopedomType.Edit;
                    Bm2.ButtonUrl = string.Format("?CMD=Edit&S_ID={0}", S_ID);
                    HeadMenuWebControls1.ButtonList.Add(Bm2);
                    break;
                case "Delete":
                    CMD_Txt = "删除";
                    sys_ApplicationsTable sat = new sys_ApplicationsTable();
                    sat.ApplicationID = S_ID;
                    sat.DB_Option_Action_ = CMD;
                    if (sat.ApplicationID != 1)
                    {
                        //删除应用表
                        BusinessFacade.sys_ApplicationsInsertUpdate(sat);
                        //删除模块表
                        BusinessFacade.sys_Module_DeleteFormAppID(S_ID);
                        //删除角色应用权限表
                        BusinessFacade.sys_RolePermission_DeleteFromAppid(S_ID);
                        //删除角色应用表
                        BusinessFacade.sys_RoleApplication_DeleteFormAppid(S_ID);
                        
                    }
                    EventMessage.MessageBox(1, "操作成功", "删除记录ID:(" + S_ID + ")成功!", Icon_Type.OK, Common.GetHomeBaseUrl("list.aspx"));
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            HeadMenuWebControls1.HeadOPTxt = TabOptionItem1.Tab_Name = All_Title_Txt;
            //Button1.Attributes.Add("Onclick", "javascript:return checkForm(aspnetForm);");
            
        }
 /// <summary>
 /// 根据ID返回 sys_ApplicationsTable实体类 单笔资料
 /// </summary>
 /// <param name="ApplicationID">自动ID 1:为系统管理应用</param>
 /// <returns>返回sys_ApplicationsTable实体类 ApplicationID为0则无记录</returns>
 public static sys_ApplicationsTable sys_ApplicationsDisp(int ApplicationID)
 {
     sys_ApplicationsTable fam = new sys_ApplicationsTable();
     QueryParam qp = new QueryParam();
     qp.PageIndex = 1;
     qp.PageSize = 1;
     qp.Where = " Where sys_Applications.ApplicationID = " + ApplicationID;
     int RecordCount = 0;
     ArrayList lst = sys_ApplicationsList(qp, out RecordCount);
     if (RecordCount > 0)
     {
         fam = (sys_ApplicationsTable)lst[0];
     }
     return fam;
 }
 /// <summary>
 /// 新增/删除/修改 sys_Applications
 /// </summary>
 /// <param name="fam">sys_ApplicationsTable实体类</param>
 /// <returns>返回0操正常</returns>
 public override int sys_ApplicationsInsertUpdate(sys_ApplicationsTable fam)
 {
     int rInt = 0;
     using (SqlConnection Conn = GetSqlConnection())
     {
         SqlCommand cmd = new SqlCommand("sys_ApplicationsInsertUpdateDelete", Conn);
         cmd.CommandType = CommandType.StoredProcedure;
         //设置参数
         cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录
         cmd.Parameters.Add("@ApplicationID", SqlDbType.Int).Value = fam.ApplicationID;  //自动ID 1:为系统管理应用
         cmd.Parameters.Add("@A_AppName", SqlDbType.NVarChar).Value = fam.A_AppName;  //应用名称
         cmd.Parameters.Add("@A_AppDescription", SqlDbType.NVarChar).Value = fam.A_AppDescription;  //应用介绍	
         cmd.Parameters.Add("@A_AppUrl", SqlDbType.VarChar).Value = fam.A_AppUrl;  //应用Url地址
         cmd.Parameters.Add("@A_Order", SqlDbType.Int).Value = fam.A_Order;
         Conn.Open();
         rInt = Convert.ToInt32(cmd.ExecuteScalar());
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rInt;
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            sys_ApplicationsTable sat = new sys_ApplicationsTable();
            sat.ApplicationID = S_ID;
            sat.A_AppDescription = (string)Common.sink(A_AppDescription.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            sat.A_AppName = (string)Common.sink(A_AppName.UniqueID, MethodType.Post, 50, 1, DataType.Str);
            sat.A_AppUrl = (string)Common.sink(A_AppUrl.UniqueID, MethodType.Post, 50, 0, DataType.Str);

            switch (CMD)
            {
                case "New":
                    CMD_Txt = "����";
                    sat.DB_Option_Action_ = "Insert";
                    break;
                case "Edit":
                    CMD_Txt = "�޸�";
                    sat.DB_Option_Action_ = "Update";
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            BusinessFacade.sys_ApplicationsInsertUpdate(sat);
            EventMessage.MessageBox(1, "�����ɹ�", string.Format("{1}ID({0})�ɹ�!", S_ID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("list.aspx"));
        }
        /// <summary>
        /// 将记录集转为sys_ApplicationsTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_ApplicationsTable</returns>
        protected object Populatesys_Applications(IDataReader dr)
        {
            sys_ApplicationsTable nc = new sys_ApplicationsTable();

            if (!Convert.IsDBNull(dr["ApplicationID"])) nc.ApplicationID = Convert.ToInt32(dr["ApplicationID"]); // 自动ID 1:为系统管理应用
            if (!Convert.IsDBNull(dr["A_AppName"])) nc.A_AppName = Convert.ToString(dr["A_AppName"]).Trim(); // 应用名称
            if (!Convert.IsDBNull(dr["A_AppDescription"])) nc.A_AppDescription = Convert.ToString(dr["A_AppDescription"]).Trim(); // 应用介绍
            if (!Convert.IsDBNull(dr["A_AppUrl"])) nc.A_AppUrl = Convert.ToString(dr["A_AppUrl"]).Trim(); // 应用Url地址
            if (!Convert.IsDBNull(dr["A_Order"])) nc.A_Order = Convert.ToInt32(dr["A_Order"]); // 应用排序
            return nc;
        }
 /// <summary>
 /// 新增/删除/修改 sys_Applications
 /// </summary>
 /// <param name="fam">sys_ApplicationsTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_ApplicationsInsertUpdate(sys_ApplicationsTable fam);
Exemple #7
0
        /// <summary>
        /// ����/ɾ��/�޸� sys_Applications
        /// </summary>
        /// <param name="fam">sys_ApplicationsTableʵ����</param>
        /// <returns>����0������</returns>
        public override int sys_ApplicationsInsertUpdate(sys_ApplicationsTable fam)
        {
            int rInt = 0;

            using (OracleConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_Applications(ApplicationID,A_AppName,A_AppDescription,A_AppUrl,A_Order)VALUES(SEQ_sys_Applications_ID.NEXTVAL,:A_AppName,:A_AppDescription,:A_AppUrl,:A_Order)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("A_Order", OracleType.Int32).Value = fam.A_Order;
                    cmd.Parameters.Add("A_AppName", OracleType.NVarChar).Value = fam.A_AppName + ""; //Ӧ������
                    cmd.Parameters.Add("A_AppDescription", OracleType.NVarChar).Value = fam.A_AppDescription + ""; //Ӧ�ý���
                    cmd.Parameters.Add("A_AppUrl", OracleType.VarChar).Value = fam.A_AppUrl + ""; //Ӧ��Url��ַ
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_Applications SET	A_Order = :A_Order,A_AppName = :A_AppName,A_AppDescription = :A_AppDescription,A_AppUrl = :A_AppUrl WHERE (ApplicationID = :ApplicationID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("A_Order", OracleType.Int32).Value = fam.A_Order;
                    cmd.Parameters.Add("A_AppName", OracleType.NVarChar).Value = fam.A_AppName + ""; //Ӧ������
                    cmd.Parameters.Add("A_AppDescription", OracleType.NVarChar).Value = fam.A_AppDescription + ""; //Ӧ�ý���
                    cmd.Parameters.Add("A_AppUrl", OracleType.VarChar).Value = fam.A_AppUrl + ""; //Ӧ��Url��ַ
                    cmd.Parameters.Add("ApplicationID", OracleType.Int32).Value = fam.ApplicationID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_Applications  WHERE (ApplicationID = :ApplicationID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("ApplicationID", OracleType.Int32).Value = fam.ApplicationID;
                }
                else
                    throw new ApplicationException("�޷�ʶ��IJ�������!");
                Conn.Open();
                OracleTransaction Tran = Conn.BeginTransaction();
                cmd.Transaction = Tran;
                try
                {
                    rInt = cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    if (fam.DB_Option_Action_ == "Insert")
                    {
                        cmd.CommandText = "select SEQ_sys_Applications_ID.CURRVAL from  dual";
                        rInt = Convert.ToInt32(cmd.ExecuteScalar());
                    }
                    Tran.Commit();
                }
                catch (Exception ex)
                {
                    Tran.Rollback();
                    throw new ApplicationException(ex.ToString());
                }
                finally
                {
                    Tran.Dispose();
                    cmd.Dispose();
                    Conn.Dispose();
                    Conn.Close();
                }
            }
            return rInt;
        }
        /// <summary>
        /// 新增/删除/修改 sys_Applications
        /// </summary>
        /// <param name="fam">sys_ApplicationsTable实体类</param>
        /// <returns>返回0操正常</returns>
        public override int sys_ApplicationsInsertUpdate(sys_ApplicationsTable fam)
        {
            int rInt = 0;

            using (OleDbConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_Applications(A_AppName,A_AppDescription,A_AppUrl,A_Order)VALUES(@A_AppName,@A_AppDescription,@A_AppUrl,@A_Order)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@A_AppName", OleDbType.VarWChar).Value = fam.A_AppName + ""; //应用名称
                    cmd.Parameters.Add("@A_AppDescription", OleDbType.VarWChar).Value = fam.A_AppDescription + ""; //应用介绍	
                    cmd.Parameters.Add("@A_AppUrl", OleDbType.VarWChar).Value = fam.A_AppUrl + ""; //应用Url地址
                    cmd.Parameters.Add("@A_Order", OleDbType.Integer).Value = fam.A_Order;
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_Applications SET	A_Order = @A_Order,A_AppName = @A_AppName,A_AppDescription = @A_AppDescription,A_AppUrl = @A_AppUrl WHERE (ApplicationID = @ApplicationID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@A_Order", OleDbType.Integer).Value = fam.A_Order;
                    cmd.Parameters.Add("@A_AppName", OleDbType.VarWChar).Value = fam.A_AppName + ""; //应用名称
                    cmd.Parameters.Add("@A_AppDescription", OleDbType.VarWChar).Value = fam.A_AppDescription + ""; //应用介绍	
                    cmd.Parameters.Add("@A_AppUrl", OleDbType.VarWChar).Value = fam.A_AppUrl + ""; //应用Url地址
                    cmd.Parameters.Add("@ApplicationID", OleDbType.Integer).Value = fam.ApplicationID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_Applications  WHERE (ApplicationID = @ApplicationID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("@ApplicationID", OleDbType.Integer).Value = fam.ApplicationID;
                }
                else
                    throw new ApplicationException("无法识别的操作命令!");
                Conn.Open();
                rInt = cmd.ExecuteNonQuery();
                if (fam.DB_Option_Action_ == "Insert")
                {
                    cmd.CommandText = "SELECT @@identity";
                    rInt = Convert.ToInt32(cmd.ExecuteScalar());
                }
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return rInt;
        }
Exemple #9
0
 /// <summary>
 /// 新增/删除/修改 sys_Applications
 /// </summary>
 /// <param name="fam">sys_ApplicationsTable实体类</param>
 /// <returns>返回0操正常</returns>
 public static int sys_ApplicationsInsertUpdate(sys_ApplicationsTable fam)
 {
     return DataProvider.Instance().sys_ApplicationsInsertUpdate(fam);
 }