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); } } }
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 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; } } } }