static void Main(string[] args) { var connection = GetMySqlConnection(); //DynamicParameters param = new DynamicParameters(); //param.Add("@BranchCode", "ydhead"); S_Branch br = new S_Branch(); br.BranchCode = "ydsoft"; br.GroupCode = "yd"; T_Base_User_Search br1 = new T_Base_User_Search(); br1.RoleId = 1; br1.PrincipalId = 0; br1.PageIndex = 1; br1.PageSize = 1; br1.Asc = true; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); var list1 = connection.GetId(br); stopwatch.Stop(); Console.WriteLine(stopwatch.ElapsedMilliseconds); Console.ReadKey(); }
public ActionResult InsertBranch(BranchModels.BranchModel branch) { try { var branch_code = Entities.S_Branch.Where(b => b.Code == branch.Code).FirstOrDefault(); if (branch_code != null) { ViewBag.Message = "Code Duplicated...."; ViewBag.Type = 2; return(View("CreateBranch")); } else { S_Branch tbl_branch = new S_Branch(); tbl_branch.BranchName = branch.BranchName; tbl_branch.ShortName = branch.ShortName; tbl_branch.Description = branch.Description; tbl_branch.Code = branch.Code; tbl_branch.Phone = branch.Phone; tbl_branch.Email = branch.Email; tbl_branch.Address = branch.Address; tbl_branch.Tax = branch.Tax.ToString(); tbl_branch.ServiceCharges = branch.ServiceCharges.ToString(); Entities.S_Branch.Add(tbl_branch); Entities.SaveChanges(); ModelState.Clear(); ViewBag.Message = "New Branch is inserted successful.."; ViewBag.Type = 1; return(View("CreateBranch")); } } catch (Exception ex) { ViewBag.Message = "Please enter complete branch data"; ViewBag.Type = 2; } return(View("CreateBranch")); }