本文整理汇总了C#中DBManager类的典型用法代码示例。如果您正苦于以下问题:C# DBManager类的具体用法?C# DBManager怎么用?C# DBManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DBManager类属于命名空间,在下文中一共展示了DBManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertUser
public string InsertUser(string Username,string Mailid)
{
string Result = "a";
DBManager DbObj=new DBManager();
DbParameter[] dbparms = new DbParameter[2];
dbparms[0] = DbObj.CreateParameter("@Username", Username);
dbparms[1] = DbObj.CreateParameter("@UserMail", Mailid);
Result = DbObj.ExecuteScalar("InsertUser", dbparms, CommandType.StoredProcedure).ToString();
return Result;
}
示例2: Save
public void Save()
{
DBManager db = new DBManager();
db.Connect();
db.Insert(String.Format("insert into product_image VALUES (null,'{0}','{1}','{2}')", productID, url, orderOfDisplay));
db.Close();
}
示例3: EditParametersForm
public EditParametersForm(DBManager aDBManager)
{
InitializeComponent();
mDBManager = aDBManager;
if (mDBManager.AlgorithmParameters == null)
{
mDBManager.AlgorithmParameters = new AlgorithmParameters();
}
ControlGroups.Add(new Control[] { firstLow, firstMedium, firstHigh});
ControlGroups.Add(new Control[] { secondLow, secondMedium, secondHigh });
ControlGroups.Add(new Control[] { thirdLow, thirdMedium, thirdHigh });
ControlGroups.Add(new Control[] { fourthLow, fourthMedium, fourthHigh });
ControlGroups.Add(new Control[] { fifthLow, fifthMedium, fifthHigh });
ControlGroups.Add(new Control[] { sixthLow, sixthMedium, sixthHigh });
ControlGroups.Add(new Control[] { seventhLow, seventhMedium, seventhHigh });
for (int i = 0; i < 7; i++)
{
foreach (var item in ControlGroups[i])
{
item.Enabled = false;
}
}
}
示例4: Save
public void Save()
{
DBManager db = new DBManager();
db.Connect();
db.Insert(String.Format("insert into size VALUES (null,'{0}')", sizeLabel));
db.Close();
}
示例5: GetFeatureInfo
public EnableFeatureInfoRec GetFeatureInfo(DBManager dbManager, FeatureType type, string subType)
{
using (IDBProvider dbInstance = SP.DB.GetInstance(dbManager))
{
return dbInstance._<EnableFeatureAccessor>().SelectInfoByType(GetFeatureTypeKey(type, subType));
}
}
示例6: InitConfiguration
private void InitConfiguration(DBManager dbManager)
{
//init vars
List<APITimeoutConfigRec> tmpConfigList;
Dictionary<APIG, APITimeoutConfigRec> tmpMapByGroup = new Dictionary<APIG, APITimeoutConfigRec>();
//get list
using (IDBProvider dbInstance = SP.DB.GetInstance(dbManager))
{
tmpConfigList = dbInstance._<APITimeoutConfigAccessor>().SelectList();
foreach (var record in tmpConfigList)
{
tmpMapByGroup.Add(record.Type, record);
}
}
//first init (if no data in the database)
Util.Enum.GetValues<APIG>().ForEach(item =>
{
if (!tmpMapByGroup.ContainsKey(item))
{
var record = new APITimeoutConfigRec
{
Type = item,
TimeoutMs = DEFAULT_TIMEOUT_MS
};
tmpConfigList.Add(record);
tmpMapByGroup.Add(item, record);
}
});
//result
Interlocked.Exchange(ref _configList, tmpConfigList);
Interlocked.Exchange(ref _mapByGroup, tmpMapByGroup);
}
示例7: SelectFromDB
public static DataRowCollection SelectFromDB(String query, String database)
{
DBManager dbManager = new DBManager();
MySqlConnection con = null;
try
{
String ip = DBConst.kDbIp;
con = dbManager.CreateConnection(ip, database);
con.Open();
MySqlCommand cmd = new MySqlCommand(query, con);
MySqlDataAdapter dataAdapter = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet("data");
dataAdapter.Fill(ds, "data");
DataRowCollection drc = ds.Tables["data"].Rows;
return drc;
}
catch (System.Exception ex)
{
logger.Warn(ex.ToString());
}
finally
{
dbManager.Close(con);
}
return null;
}
示例8: Save
public void Save()
{
DBManager db = new DBManager();
db.Connect();
db.Insert(String.Format("insert into size_map VALUES (null,'{0}','{1}')", productID, sizeID));
db.Close();
}
示例9: Save
public void Save()
{
DBManager db = new DBManager();
db.Connect();
db.Insert(String.Format("insert into product_detail VALUES (null,'{0}')", description));
db.Close();
}
示例10: Execute
public static int Execute(String query, String database)
{
DBManager dbManager = new DBManager();
MySqlConnection con = null;
try
{
String ip = DBConst.kDbIp;
con = dbManager.CreateConnection(ip, database);
con.Open();
MySqlCommand cmd = new MySqlCommand(query, con);
int ret = cmd.ExecuteNonQuery();
return ret;
}
catch (System.Exception ex)
{
logger.Warn(ex.ToString());
}
finally
{
dbManager.Close(con);
}
return -1;
}
示例11: checkForErrors
public bool checkForErrors(DBManager dbManager)
{
//this should wipe error messages first
removeNotificationsByType(typeof(NotifyError));
foreach (Supervillain s in dbManager.SupervillainDB.listOfSupervillains()){
//check for undecided students
if (s.Age.GetType() == typeof(Student)){
if (((Student) s.Age).School.GetType() == typeof (Undecided)) {
addNotification(new Notification(new NotifyError(),
"Assign " + s.SuperhumanName + " a school!"));
}
}
//check for unemployed adults
else if (s.Age.GetType() == typeof(Adult)) {
if (((Adult)s.Age).Occupation.GetType() == typeof(Unemployed)) {
addNotification(new Notification(new NotifyError(),
"Assign " + s.SuperhumanName + " an occupation!"));
}
}
}
//more than 4 classes in a cirrculum
//...
return findErrorNotifications();
}
示例12: GetAllDataListCategory
static public DataTable GetAllDataListCategory()
{
String SQL = "select Category, Category from Sch.DesignformDatalist group by category";
DBManager db = new DBManager();
return db.GetDataTableFromSQL(SQL);
}
示例13: EditGroupsForm
public EditGroupsForm(DBManager aDBManager, int classID)
{
InitializeComponent();
mDBManager = aDBManager;
mClass = mDBManager.Classes[0];
foreach(var c in mDBManager.Classes){
if(c.ID == classID){
mClass = c;
break;
}
}
gridviewGroups.Columns.Add("Име");
gridviewGroups.AllowAutoSizeColumns = true;
gridviewGroups.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
gridviewGroups.AllowDrop = false;
gridviewGroups.AllowMultiColumnSorting = false;
gridviewGroups.AllowDragToGroup = false;
gridviewGroups.ShowGroupPanel = false;
try
{
foreach (var group in mClass.Groups)
{
gridviewGroups.Rows.Add(group);
}
}
catch {
mClass.Groups = new List<string>();
}
}
示例14: AddOrEditClassForm
public AddOrEditClassForm(DBManager dbManag)
{
InitializeComponent();
mDBManager = dbManag;
this.Text = FormTitles.ClassForm.Add;
mFormState = FormState.AddingNew;
RadListDataItem dropDownItem = new RadListDataItem("1");
dropDownItem.Value = 1;
dropDownItem.Selected = true;
gradeDropdownlist.Items.Add(dropDownItem);
for (int i = 2; i <= 12; ++i)
{
dropDownItem = new RadListDataItem(i.ToString());
dropDownItem.Value = i;
gradeDropdownlist.Items.Add(dropDownItem);
}
importTeachersFromTheDatabase();
changingHeadteacherReadyButton.Visible = false;
teachersDropdownlist.Visible = false;
changeHeadTeacherButton.Visible = false;
changingHeadteacherReadyButton.Visible = true;
teachersDropdownlist.Visible = true;
colorPanel.BackColor = RandomColor.GetRandomColor();
gradeDropdownlist.DropDownStyle = RadDropDownStyle.DropDownList;
teachersDropdownlist.DropDownStyle = RadDropDownStyle.DropDownList;
}
示例15: AssemblyDetailsForm_Load
private void AssemblyDetailsForm_Load(object sender, EventArgs e)
{
manager = new DBManager(RevitDocument);
//if (this.IsAdd)
//{
// lblTitle.Text = "";
//}
//else
//{
toSwap = CurrentAssembly;
// lblToSwap.Text = toSwap.AssemblyName;
loadInformation(toSwap);
//}
List<Assembly> fromModel = manager.RetrieveWallInfo();
//List<Assembly> options = null;
//if (this.IsAdd)
//options = manager.getAllAssemblies();
//options.AddRange(fromModel);
//else
// options = manager.getAssembliesByCode(toSwap.AssemblyCode);
//if (options != null)
//{
// foreach (Assembly a in options)
// cboAlternatives.Items.Add(a);
//}
}