public static List <UILayoutConfig> GetLayoutConfig() { List <UILayoutConfig> layoutConfig = new List <UILayoutConfig>(); string strQuery = "Select TaskId, Module, GroupId, ElementId, MenuType, Controller, ActionName, Image, Caption, FullName, " + "AccessKey, MenuSize, Flag, CreateDtm, CreatedBy, ModifiedDtm, ModifiedBy, ModuleImage, DataRowVersion , SerializeName,ValidateForm, RenderSection, OverideFunction,Align,TranCode,Isseparator,Ismandatory , ParentGroupId , TranAccount from tUILayoutConfig"; string connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageProviderConnection"].ToString(); IDataProvider iDataProvider = new SqlCEDataProvider(connectionString);//ConfigProvider.ConfigHelper.GetDataProvider(); using (IDbConnection dbConnection = iDataProvider.GetConnection) { dbConnection.Open(); IDbCommand iDbCommand = iDataProvider.GetCommand(strQuery, dbConnection, null, CommandType.Text); DbDataReader dbDataReader = iDataProvider.ExecuteQuery(iDbCommand); //if (dbDataReader.HasRows) { while (dbDataReader.Read()) { UILayoutConfig uiLayoutConfig = new UILayoutConfig(); uiLayoutConfig.TaskID = Convert.ToInt32(dbDataReader["TaskId"].ToString()); uiLayoutConfig.ModuleName = dbDataReader["Module"].ToString(); uiLayoutConfig.GroupId = Convert.ToInt32(dbDataReader["GroupId"].ToString()); uiLayoutConfig.ElementId = Convert.ToInt32(dbDataReader["ElementId"].ToString()); uiLayoutConfig.MenuType = dbDataReader["MenuType"].ToString(); uiLayoutConfig.ControllerName = dbDataReader["Controller"].ToString(); uiLayoutConfig.ActionName = dbDataReader["ActionName"].ToString(); uiLayoutConfig.Image = dbDataReader["Image"].ToString(); uiLayoutConfig.Caption = dbDataReader["Caption"].ToString(); uiLayoutConfig.FullName = dbDataReader["FullName"].ToString(); uiLayoutConfig.AccessKey = dbDataReader["AccessKey"].ToString(); uiLayoutConfig.Size = dbDataReader["MenuSize"].ToString(); uiLayoutConfig.IsModule = true; uiLayoutConfig.Flag = true; uiLayoutConfig.CreateDtm = Convert.ToDateTime(dbDataReader["CreateDtm"].ToString()); uiLayoutConfig.CreatedBy = Convert.ToInt32(dbDataReader["GroupId"].ToString()); uiLayoutConfig.ModifiedDtm = Convert.ToDateTime(dbDataReader["ModifiedDtm"].ToString()); uiLayoutConfig.ModifiedBy = Convert.ToInt32(dbDataReader["GroupId"].ToString()); uiLayoutConfig.ModuleImage = dbDataReader["ModuleImage"].ToString(); uiLayoutConfig.DataRowVersion = Convert.ToInt32(dbDataReader["DataRowVersion"].ToString()); uiLayoutConfig.SerializeName = (dbDataReader["SerializeName"] != null) ? dbDataReader["SerializeName"].ToString() : string.Empty; uiLayoutConfig.ValidateForm = (dbDataReader["ValidateForm"] != null) ? Convert.ToBoolean(dbDataReader["ValidateForm"]) : false; uiLayoutConfig.RenderSection = dbDataReader["RenderSection"].ToString(); uiLayoutConfig.OverideFunction = dbDataReader["OverideFunction"].ToString(); uiLayoutConfig.Align = (dbDataReader["Align"] != null) ? dbDataReader["Align"].ToString() : string.Empty; uiLayoutConfig.TranCode = (dbDataReader["TranCode"] != null) ? dbDataReader["TranCode"].ToString() : string.Empty; uiLayoutConfig.Isseparator = (dbDataReader["Isseparator"] != null) ? dbDataReader["Isseparator"].ToString() : string.Empty; uiLayoutConfig.Ismandatory = (dbDataReader["Ismandatory"] != null) ? dbDataReader["Ismandatory"].ToString() : string.Empty; uiLayoutConfig.ParentGroupId = (dbDataReader["ParentGroupId"] != null) ? dbDataReader["ParentGroupId"].ToString() : "0"; uiLayoutConfig.TranAccount = (dbDataReader["TranAccount"] != null) ? dbDataReader["TranAccount"].ToString() : "0"; layoutConfig.Add(uiLayoutConfig); } dbDataReader.Close(); } } return(layoutConfig); }
public static void CreateErrorResourceXml() { string strErrorResouce = "Select ErrorKey, ErrorMessage,Language from tErrorResource"; string connectionString = System.Configuration.ConfigurationManager.AppSettings["ResourceDbConnection"].ToString(); IDataProvider iDataProvider = new SqlCEDataProvider(connectionString); using (IDbConnection iDbConnection = iDataProvider.GetConnection) { iDbConnection.Open(); IDbCommand Errorcommand = iDataProvider.GetCommand(strErrorResouce, iDbConnection, null, CommandType.Text); IDataReader errorDataReader = iDataProvider.ExecuteQuery(Errorcommand); WriteErrorResourceXml(errorDataReader); } }
public static void CreateStringResourceXml() { string connectionString = System.Configuration.ConfigurationManager.AppSettings["ResourceDbConnection"].ToString(); IDataProvider iDataProvider = new SqlCEDataProvider(connectionString); using (IDbConnection iDbConnection = iDataProvider.GetConnection) { iDbConnection.Open(); string strStringResource = "Select ResourceKey, ResourceValue, Language from tStringResource"; IDbCommand command = iDataProvider.GetCommand(strStringResource, iDbConnection, null, CommandType.Text); IDataReader resourceDataReader = iDataProvider.ExecuteQuery(command); WriteStringResourceXml(resourceDataReader); } }
public static void CreateConfigXml() { string connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageProviderConnection"].ToString(); IDataProvider iDataProvider = new SqlCEDataProvider(connectionString); using (IDbConnection iDbConnection = iDataProvider.GetConnection) { iDbConnection.Open(); string strQuery = "Select TaskId, Module, GroupId, ElementId, MenuType, Controller, ActionName, Image, Caption, FullName, " + "AccessKey, MenuSize, Flag, CreateDtm, CreatedBy, ModifiedDtm, ModifiedBy, ModuleImage, DataRowVersion,SerializeName, ValidateForm, RenderSection , OverideFunction,Align,TranCode, Isseparator, Ismandatory, ParentGroupId, TranAccount from tUILayoutConfig"; IDbCommand command = iDataProvider.GetCommand(strQuery, iDbConnection, null, CommandType.Text); IDataReader resourceDataReader = iDataProvider.ExecuteQuery(command); WriteConfigXml(resourceDataReader); } }