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;

        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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);
            }

        }
示例#5
0
        public static void SaveStringResourceXml()
        {
            DeleteResourceRecords();
            XmlTextReader xmlTextReader = new XmlTextReader(AppDomain.CurrentDomain.BaseDirectory + @"\Configurations\StringResources.xml");

            string connectionString = System.Configuration.ConfigurationManager.AppSettings["ResourceDbConnection"].ToString();
            IDataProvider iDataProvider = new SqlCEDataProvider(connectionString);
            string strQuery = "INSERT INTO tStringResource (ResourceKey, ResourceValue, Language) VALUES(@ResourceKey, @ResourceValue, @Language)";
            using (IDbConnection iDbConnection = iDataProvider.GetConnection)
            {
                iDbConnection.Open();

                while (xmlTextReader.Read())
                {
                    List<KeyValuePair<string, object>> resourceParameters = new List<KeyValuePair<string, object>>();

                    switch (xmlTextReader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (xmlTextReader.Name == "Resource")
                            {
                                resourceParameters.Add(new KeyValuePair<string, object>("@ResourceKey", xmlTextReader.GetAttribute("ResourceKey")));
                                resourceParameters.Add(new KeyValuePair<string, object>("@ResourceValue", xmlTextReader.GetAttribute("ResourceValue")));
                                resourceParameters.Add(new KeyValuePair<string, object>("@Language", xmlTextReader.GetAttribute("Language")));
                            }
                            break;
                        default:
                            break;
                    }



                    if (resourceParameters != null && resourceParameters.Count > 0)
                    {
                        IDbCommand command = iDataProvider.GetCommand(strQuery, iDbConnection, iDataProvider.GetParameter(resourceParameters), CommandType.Text);
                        command.ExecuteNonQuery();
                    }
                }
            }
        }
示例#6
0
        private static void DeleteResourceRecords()
        {
            string strDeleteStringResource = "Delete From tStringResource";
            string strDeleteErrorResource = "Delete From tErrorResource";

            string connectionString = System.Configuration.ConfigurationManager.AppSettings["ResourceDbConnection"].ToString();
            IDataProvider iDataProvider = new SqlCEDataProvider(connectionString);

            using (IDbConnection iDbConnection = iDataProvider.GetConnection)
            {
                iDbConnection.Open();

                IDbCommand resourCommand = iDataProvider.GetCommand(strDeleteStringResource, iDbConnection, null, CommandType.Text);
                resourCommand.ExecuteNonQuery();

                IDbCommand errorCommand = iDataProvider.GetCommand(strDeleteErrorResource, iDbConnection, null, CommandType.Text);
                errorCommand.ExecuteNonQuery();
            }
        }
 public static void UpdateUIConfigList(UILayoutConfig messageObject)
 {
     string updateQuery = "Update tUILayoutConfig Set TaskId = @TaskId, Module = @Module, GroupId = @GroupId, ElementId = @ElementId, MenuType=@MenuType, Controller=@Controller, ActionName=@ActionName, Image=@Image" +
                          "Caption = @Caption, FullName=@FullName, AccessKey = @AccessKey, MenuSize = @MenuSize, Flag = @Flag, CreateDtm=@CreateDtm, CreatedBy=@CreatedBy, ModifiedDtm=@ModifiedDtm, ModifiedBy = @ModifiedBy " +
                          "ModuleImage=@ModuleImage, DataRowVersion=@DataRowVersion, SerializeName=@SerializeName, ValidateForm=@ValidateForm , RenderSection = @RenderSection, OverideFunction = @OverideFunction,Align = @Align, TranCode = @TranCode, Isseparator = @Isseparator, Ismandatory = @Ismandatory, ParentGroupId = @ParentGroupId, TranAccount =@TranAccount";
     string connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageProviderConnection"].ToString();
     IDataProvider iDataProvider = new SqlCEDataProvider(connectionString);//ConfigProvider.ConfigHelper.GetDataProvider()
     using (IDbConnection iDbConnection = iDataProvider.GetConnection)
     {
         iDbConnection.Open();
         IDbCommand iDbcommand = iDataProvider.GetCommand(updateQuery, iDbConnection, iDataProvider.GetParameter(FormParameters(messageObject)), CommandType.Text);
         iDataProvider.ExecuteNonQuery(iDbcommand);
     }
 }
        public static void InsertUIConfigList(UILayoutConfig messageObject)
        {
            if (messageObject != null)
            {

                string InsertQuery = "INSERT INTO tUILayoutConfig (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) "
                + "VALUES(@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 )";

                string connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageProviderConnection"].ToString();
                IDataProvider iDataProvider = new SqlCEDataProvider(connectionString);//ConfigProvider.ConfigHelper.GetDataProvider()
                using (IDbConnection iDbConnection = iDataProvider.GetConnection)
                {
                    iDbConnection.Open();
                    IDbCommand iDbcommand = iDataProvider.GetCommand(InsertQuery, iDbConnection, iDataProvider.GetParameter(FormParameters(messageObject)), CommandType.Text);
                    iDataProvider.ExecuteNonQuery(iDbcommand);
                }
            }
        }
示例#9
0
        public static void SaveConfigXml()
        {

            DeleteLayoutConfigRecords();

            XmlTextReader xmlTextReader = new XmlTextReader(AppDomain.CurrentDomain.BaseDirectory + @"\Configurations\UILayoutConfig.xml");

            string InsertQuery = "INSERT INTO tUILayoutConfig (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)"
              + "VALUES(@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)";

            string connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageProviderConnection"].ToString();
            IDataProvider iDataProvider = new SqlCEDataProvider(connectionString);//ConfigProvider.ConfigHelper.GetDataProvider()
            using (IDbConnection iDbConnection = iDataProvider.GetConnection)
            {
                iDbConnection.Open();
                while (xmlTextReader.Read())
                {
                    List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
                    switch (xmlTextReader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (xmlTextReader.Name == "ConfigSections")
                            {
                                parameters.Add(new KeyValuePair<string, object>("@TaskId",string.IsNullOrEmpty(xmlTextReader.GetAttribute("TaskId"))  ? "0" : xmlTextReader.GetAttribute("TaskId")));
                                parameters.Add(new KeyValuePair<string, object>("@Module", xmlTextReader.GetAttribute("Module")));
                                parameters.Add(new KeyValuePair<string, object>("@GroupId", xmlTextReader.GetAttribute("GroupId")));
                                parameters.Add(new KeyValuePair<string, object>("@ElementId", xmlTextReader.GetAttribute("ElementId")));
                                parameters.Add(new KeyValuePair<string, object>("@MenuType", xmlTextReader.GetAttribute("MenuType")));
                                parameters.Add(new KeyValuePair<string, object>("@Controller", xmlTextReader.GetAttribute("Controller") == null ? string.Empty : xmlTextReader.GetAttribute("Controller")));
                                parameters.Add(new KeyValuePair<string, object>("@ActionName", xmlTextReader.GetAttribute("ActionName") == null ? string.Empty : xmlTextReader.GetAttribute("ActionName")));
                                parameters.Add(new KeyValuePair<string, object>("@Image", xmlTextReader.GetAttribute("Image")));
                                parameters.Add(new KeyValuePair<string, object>("@Caption", xmlTextReader.GetAttribute("Caption")));
                                parameters.Add(new KeyValuePair<string, object>("@FullName", string.Empty));
                                parameters.Add(new KeyValuePair<string, object>("@AccessKey", string.Empty));
                                parameters.Add(new KeyValuePair<string, object>("@MenuSize", xmlTextReader.GetAttribute("MenuSize")));
                                parameters.Add(new KeyValuePair<string, object>("@Flag", true));
                                parameters.Add(new KeyValuePair<string, object>("@CreateDtm", DateTime.Now.ToString()));
                                parameters.Add(new KeyValuePair<string, object>("@CreatedBy", "1"));
                                parameters.Add(new KeyValuePair<string, object>("@ModifiedDtm", DateTime.Now.ToString()));
                                parameters.Add(new KeyValuePair<string, object>("@ModifiedBy", 1));
                                parameters.Add(new KeyValuePair<string, object>("@ModuleImage", xmlTextReader.GetAttribute("ModuleImage") == null ? string.Empty : xmlTextReader.GetAttribute("ModuleImage")));
                                parameters.Add(new KeyValuePair<string, object>("@DataRowVersion", 1));
                                parameters.Add(new KeyValuePair<string, object>("@SerializeName", xmlTextReader.GetAttribute("SerializeName") == null ? string.Empty : xmlTextReader.GetAttribute("SerializeName")));
                                parameters.Add(new KeyValuePair<string, object>("@ValidateForm", false));
                                parameters.Add(new KeyValuePair<string, object>("@RenderSection", xmlTextReader.GetAttribute("RenderSection")));
                                parameters.Add(new KeyValuePair<string, object>("@OverideFunction", xmlTextReader.GetAttribute("OverideFunction") == null ? string.Empty : xmlTextReader.GetAttribute("OverideFunction")));
                                parameters.Add(new KeyValuePair<string, object>("@Align", xmlTextReader.GetAttribute("Align") == null ? string.Empty : xmlTextReader.GetAttribute("Align")));
                                parameters.Add(new KeyValuePair<string, object>("@TranCode", xmlTextReader.GetAttribute("TranCode") == null ? string.Empty : xmlTextReader.GetAttribute("TranCode")));
                                parameters.Add(new KeyValuePair<string, object>("@Isseparator", xmlTextReader.GetAttribute("Isseparator") == null ? string.Empty : xmlTextReader.GetAttribute("Isseparator")));
                                parameters.Add(new KeyValuePair<string, object>("@Ismandatory", xmlTextReader.GetAttribute("Ismandatory") == null ? string.Empty : xmlTextReader.GetAttribute("Ismandatory")));
                                parameters.Add(new KeyValuePair<string, object>("@ParentGroupId", xmlTextReader.GetAttribute("ParentGroupId") == null ? "0" : xmlTextReader.GetAttribute("ParentGroupId")));
                                parameters.Add(new KeyValuePair<string, object>("@TranAccount", xmlTextReader.GetAttribute("TranAccount") == null ? "0" : xmlTextReader.GetAttribute("TranAccount")));

                                IDbCommand iDbcommand = iDataProvider.GetCommand(InsertQuery, iDbConnection, iDataProvider.GetParameter(parameters), CommandType.Text);
                                iDataProvider.ExecuteNonQuery(iDbcommand);
                            }
                            break;
                        default:
                            break;
                    }
                }
            }
        }
示例#10
0
        private static void DeleteLayoutConfigRecords()
        {
            string strDeleteUIConfig = "Delete From tUILayoutConfig";


            string connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageProviderConnection"].ToString();
            IDataProvider iDataProvider = new SqlCEDataProvider(connectionString);

            using (IDbConnection iDbConnection = iDataProvider.GetConnection)
            {
                iDbConnection.Open();

                IDbCommand resourCommand = iDataProvider.GetCommand(strDeleteUIConfig, iDbConnection, null, CommandType.Text);
                resourCommand.ExecuteNonQuery();

            }
        }