public ActionResult AllEmployees() { var obj = new DBComponent(); var model = obj.GetAllEmployees(); return(View(model)); }
private void SendMSG(Object sender, mCore.NewMessageReceivedEventArgs e) { string smsMsg = DBComponent.userSession(e.TextMessage.Trim(), e.Phone); sendSMS(e.Phone, smsMsg); //Send the message }
protected void btnReg_Click(object sender, EventArgs e) { if (this.IsValid) { bool b; long vcd; vcd = DBComponent.GenerateVerification(); b = DBComponent.userSignup(txtunm.Text.Trim(), txtMbno.Text.Trim(), vcd.ToString()); if (b) { lblMsg.Text = "Registered Successfully, Verification code Sent To Your Mobile"; this.Session["username"] = txtunm.Text.Trim(); this.Session["mbno"] = txtMbno.Text.Trim(); SMS sobj = (SMS)Application["SmsObject"]; sobj.sendSMS(txtMbno.Text.Trim(), "Your Verification Code is " + vcd.ToString() + " oPas - A User Verification Protocol"); BtnNext.Enabled = true; btnReg.Enabled = false; } else { lblMsg.Text = "Failed to Register,Try After Some Time"; } } else { lblMsg.Text = "Please Correct The Errors"; } }
public ActionResult Edit(EmpTable emp) { var obj = new DBComponent(); obj.UpdateEmployee(emp); return(RedirectToAction("AllEmployees"));//Moves the code to the Action AllEmployees... }
private void checkpss(Object sender, mCore.NewMessageReceivedEventArgs e) { bool b, c; number = e.Phone; string name = this.Session["unm"].ToString(); c = DBComponent.chkmbno(e.Phone.Trim()); if (c) { b = DBComponent.changenum(e.TextMessage, name, e.Phone); if (b) { s = 1; } else { s = 1; r = 2; } } else { s = 1; r = 1; } }
protected async ETVoid RunAsync(Session session, DBSaveRequest message, Action <DBSaveResponse> reply) { DBSaveResponse response = new DBSaveResponse(); try { DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>(); if (string.IsNullOrEmpty(message.CollectionName)) { // myDebugInfo(session, message);//[MyAppend] if (message.Component != null) //[MyAppend] { //[MyAppend] message.CollectionName = message.Component.GetType().Name; }//[MyAppend] } await dbComponent.Add(message.Component, message.CollectionName); reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
public ActionResult AddNew(EmpTable emp) { var obj = new DBComponent(); obj.AddNewEmployee(emp); return(RedirectToAction("AllEmployees")); }
public ActionResult AddNew(Employee emp) { var com = new DBComponent(); com.AddEmployee(emp); return(RedirectToAction("AllEmployees")); }
public ActionResult Delete(int id) { var com = new DBComponent(); com.DeleteEmployee(id); return(RedirectToAction("AllEmployees")); }
[HttpPost]//As there are 2 methods, we should differ them by the HTTP Method.... public ActionResult Edit(Employee emp) { var com = new DBComponent(); com.UpdateEmployee(emp); return(RedirectToAction("AllEmployees"));//Redirecting to the Table View... }
protected override async ETTask Run(Session session, DBQueryBatchRequest request, DBQueryBatchResponse response, Action reply) { DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>(); response.Components = await dbComponent.GetBatch(request.CollectionName, request.IdList); reply(); }
public ActionResult Edit(string id) { var com = new DBComponent(); int empId = int.Parse(id); var model = com.FindEmployee(empId); return(View(model)); }
public static async ETTask <Gamer> GetGamerFromDB(Entity domain, DBComponent db, long gamerid) { Gamer gamer = await db.Query <Gamer>(gamerid); gamer.Domain = domain; return(gamer); }
public static async Task <long> QueryJsonCount <T>(this DBProxyComponent self, string json) { DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>(); FilterDefinition <ComponentWithId> filterDefinition = new JsonFilterDefinition <ComponentWithId>(json); long count = await dbComponent.GetCollection(typeof(T).Name).CountAsync(filterDefinition); return(count); }
public static async ETTask <long> GetIncrementId <T>(this DBComponent self) { var collection = self.GetCollection <CollectionIdentity>(); CollectionIdentity id = await collection.FindOneAndUpdateAsync(Builders <CollectionIdentity> .Filter.Eq(f => f.Id, typeof(T).Name), Builders <CollectionIdentity> .Update.Inc(f => f.Value, 1), options); return(id.Value); }
public static async ETTask <long> Remove <T>(this DBComponent self, long taskId, long id, string collection = null) where T : Entity { using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount)) { DeleteResult result = await self.GetCollection <T>(collection).DeleteOneAsync(d => d.Id == id); return(result.DeletedCount); } }
public static async ETTask <long> Remove <T>(this DBComponent self, Expression <Func <T, bool> > filter, string collection = null) where T : Entity { using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, RandomHelper.RandInt64() % DBComponent.TaskCount)) { DeleteResult result = await self.GetCollection <T>(collection).DeleteManyAsync(filter); return(result.DeletedCount); } }
/// <summary> /// 根据表达式删除 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="exp"></param> /// <returns></returns> public static async ETTask DeleteAll <T>(this DBProxyComponent self, Expression <Func <T, bool> > exp) { DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>(); ExpressionFilterDefinition <T> filter = new ExpressionFilterDefinition <T>(exp); IBsonSerializerRegistry serializerRegistry = BsonSerializer.SerializerRegistry; IBsonSerializer <T> documentSerializer = serializerRegistry.GetSerializer <T>(); string json = filter.Render(documentSerializer, serializerRegistry).ToJson(); await dbComponent.GetCollection(typeof(T).Name).FindOneAndDeleteAsync(json); }
public static async ETTask <T> Query <T>(this DBComponent self, long id, string collection = null) where T : Entity { using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, id % DBComponent.TaskCount)) { IAsyncCursor <T> cursor = await self.GetCollection <T>(collection).FindAsync(d => d.Id == id); return(await cursor.FirstOrDefaultAsync()); } }
public static void Update <T>(this DBProxyComponent self, string fieldname, string fieldvalue, string aaa) { //第一个参数是需要更改的在数据库中的对象 第二个是要更改的对象的值 第三个是更改后的对象的值 对象也可以改 多传点参数就行 DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>(); var filter1 = Builders <ComponentWithId> .Filter.Eq(fieldname, fieldvalue); var updata1 = Builders <ComponentWithId> .Update.Set(fieldname, aaa); dbComponent.GetCollection(typeof(T).Name).UpdateOne(filter1, updata1); }
public static async ETTask <List <T> > QueryJson <T>(this DBComponent self, long taskId, string json, string collection = null) where T : Entity { using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, RandomHelper.RandInt64() % DBComponent.TaskCount)) { FilterDefinition <T> filterDefinition = new JsonFilterDefinition <T>(json); IAsyncCursor <T> cursor = await self.GetCollection <T>(collection).FindAsync(filterDefinition); return(await cursor.ToListAsync()); } }
public static async Task <List <T> > QueryJsonDBInfos <T>(this DBProxyComponent self, string time, long uid) { DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>(); FilterDefinition <T> filterDefinition = new JsonFilterDefinition <T>($"{{CreateTime:/^{time}/,Uid:{uid}}}"); IAsyncCursor <T> cursor = await dbComponent.GetDBDataCollection <T>(typeof(T).Name).FindAsync(filterDefinition); List <T> components = await cursor.ToListAsync(); return(components); }
static void Main(string[] args) { var com = new DBComponent(); DataTable table = com.GetAllEmployees(); foreach (DataRow row in table.Rows) { Console.WriteLine(row["EmpName"]); } }
public static async ETTask <List <T> > Query <T>(this DBComponent self, long taskId, Expression <Func <T, bool> > filter, string collection = null) where T : Entity { using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount)) { IAsyncCursor <T> cursor = await self.GetCollection <T>(collection).FindAsync(filter); return(await cursor.ToListAsync()); } }
public static async Task <List <T> > QueryJsonDB <T>(this DBProxyComponent self, string json) where T : ComponentWithId { DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>(); FilterDefinition <T> filterDefinition = new JsonFilterDefinition <T>(json); IAsyncCursor <T> cursor = await dbComponent.GetDBDataCollection <T>(typeof(T).Name).FindAsync(filterDefinition); List <T> components = await cursor.ToListAsync(); return(components); }
protected void Page_Load(object sender, EventArgs e) { string name = this.Session["unm"].ToString(); DataTable dt = DBComponent.getUser(name); if (dt != null) { txtque.Text = dt.Rows[0]["Secque"].ToString(); ans = dt.Rows[0]["Secans"].ToString(); } }
public ActionResult AddNew() { var obj = new DBComponent(); var depts = obj.GetAllDepts().Select(e => new SelectListItem { Text = e.DeptName, Value = e.DeptId.ToString() }).ToList(); //Get all Depts from the source and convert it to List<SelectListItem> to use it inside DropDownList.... ViewBag.Depts = depts;//Add it to ViewBag object to display in the view... return(View(new EmpTable())); }
public static async ETVoid SaveNotWait <T>(this DBComponent self, T entity, long taskId = 0, string collection = null) where T : Entity { if (taskId == 0) { await self.Save(entity, collection); return; } await self.Save(taskId, entity, collection); }
protected void btnReg_Click(object sender, EventArgs e) { if (DBComponent.authenticateUser(txtunm.Text.Trim())) { this.Session["unm"] = txtunm.Text; Response.Redirect("~/Menu.aspx"); } else { lblMsg.Text = "SMS Your Password"; } }
public static async ETTask InsertBatch <T>(this DBComponent self, IEnumerable <T> list, string collection = null) where T : Entity { if (collection == null) { collection = typeof(T).Name; } using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, RandomHelper.RandInt64() % DBComponent.TaskCount)) { await self.GetCollection(collection).InsertManyAsync(list); } }