void AddNewStoredProcedure() { string spname = txtspname.Text.Trim(); StoredProcedureBusiness spData = new StoredProcedureBusiness(); var splist = spData.GetStoredProcedureList(AppTimeConfiguration.MainServer); if (splist.Select(x => x.SPName.ToLower()).Contains(spname.ToLower())) { string procname = splist.Where(x => x.SPName.ToLower() == spname.ToLower()).First().SPName; EntityBusiness edata = new EntityBusiness(); SPModel sp = new SPModel(); sp.SPName = procname; sp.SPDate = dtpScriptDate.Value; sp.CreatedDate = DateTime.Now; long res = edata.AddNewSP(sp); if (res != -1) { LoadStoredProcedures(dtpScriptDate.Value); txtspname.Clear(); } else { MessageBox.Show("Stored Procedures already exists.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Stored Procedures does not exists in current database.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public long AddNewSP(SPModel sp) { try { using (DevKitEntities db = new DevKitEntities()) { bool exists = db.StoredProcedures.AsEnumerable().Any(x => x.SPName.ToLower() == sp.SPName.ToLower() && x.SPDate == sp.SPDate); if (exists) { return(-1); } StoredProcedure nsp = new StoredProcedure(); nsp.SPName = sp.SPName; nsp.CreatedDate = sp.CreatedDate; nsp.SPDate = sp.SPDate; db.StoredProcedures.Add(nsp); db.SaveChanges(); return(nsp.Id); } } catch (Exception ex) { throw new Exception(ex.Message); } }
// POST api/SPUser?JsonEmployee public void Post([FromBody] Employee e) { using (var ctx = new SPModel()) { var employee = ctx.Set <Employee>(); employee.Add(new Employee { EmID = e.EmID, EmFname = e.EmFname, EmLname = e.EmLname, UserName = e.UserName, Password = e.Password, admin = e.admin, addJob = e.addJob, EditJob = e.EditJob, Department = e.Department, SaleName = e.SaleName, CHK = e.CHK, DepID = e.DepID, stat = e.stat, Email = e.Email }); ctx.SaveChanges(); } }
// PUT api/SPUser?EmID&JsonEmployee public void Put(int EmID, [FromBody] Employee e) { using (var ctx = new SPModel()) { // Update Statement var update = ctx.Employees.Where(ei => ei.EmID == EmID).FirstOrDefault(); if (update != null) { update.EmID = e.EmID; update.EmFname = e.EmFname; update.EmLname = e.EmLname; update.UserName = e.UserName; update.Password = e.Password; update.admin = e.admin; update.addJob = e.addJob; update.EditJob = e.EditJob; update.Department = e.Department; update.SaleName = e.SaleName; update.CHK = e.CHK; update.DepID = e.DepID; update.stat = e.stat; update.Email = e.Email; } ctx.SaveChanges(); } }
// PUT api/SPCalendar?jobid&JsonJob public void Put(int JobID, [FromBody] Job J) { using (var ctx = new SPModel()) { // Update Statement var update = ctx.Jobs.Where(ji => ji.JobID == JobID).FirstOrDefault(); if (update != null) { update.JobID = J.JobID; update.JobDate = J.JobDate; update.CustFname = J.CustFname; update.CustLname = J.CustLname; update.JobType = J.JobType; update.JobCuft = J.JobCuft; update.TruckTrip = J.TruckTrip; update.Trip = J.Trip; update.EmID = J.EmID; update.JobStatus = J.JobStatus; update.Location = J.Location; update.Remark = J.Remark; update.Sale = J.Sale; update.Origin = J.Origin; update.Tel = J.Tel; update.StatusCon = J.StatusCon; update.JobRefNo = J.JobRefNo; update.ConId = J.ConId; update.VUnit = J.VUnit; update.TT1 = J.TT1; update.TT2 = J.TT2; update.TT3 = J.TT3; update.TT4 = J.TT4; update.TT5 = J.TT5; update.TEAM = J.TEAM; update.CRTIME = J.CRTIME; update.CRNAME = J.CRNAME; update.TEAMCO = J.TEAMCO; update.TEAMNAME = J.TEAMNAME; update.Book1 = J.Book1; update.Department1 = J.Department1; update.Direction1 = J.Direction1; update.Book2 = J.Book2; update.Department2 = J.Department2; update.Direction2 = J.Direction2; update.Book3 = J.Book3; update.Department3 = J.Department3; update.Direction3 = J.Direction3; update.TeamUnit = J.TeamUnit; update.InqId = J.InqId; update.AppointTime = J.AppointTime; update.ComId = J.ComId; update.CusId = J.CusId; update.SJobRefNo = J.SJobRefNo; update.SConId = J.SConId; update.CusPhone = J.CusPhone; } ctx.SaveChanges(); } }
// POST api/SPCalendar?JsonJob public void Post([FromBody] Job J) { using (var ctx = new SPModel()) { var calendar = ctx.Set <Job>(); calendar.Add(new Job { JobID = J.JobID, JobDate = J.JobDate, CustFname = J.CustFname, CustLname = J.CustLname, JobType = J.JobType, JobCuft = J.JobCuft, TruckTrip = J.TruckTrip, Trip = J.Trip, EmID = J.EmID, JobStatus = J.JobStatus, Location = J.Location, Remark = J.Remark, Sale = J.Sale, Origin = J.Origin, Tel = J.Tel, StatusCon = J.StatusCon, JobRefNo = J.JobRefNo, ConId = J.ConId, VUnit = J.VUnit, TT1 = J.TT1, TT2 = J.TT2, TT3 = J.TT3, TT4 = J.TT4, TT5 = J.TT5, TEAM = J.TEAM, CRTIME = J.CRTIME, CRNAME = J.CRNAME, TEAMCO = J.TEAMCO, TEAMNAME = J.TEAMNAME, Book1 = J.Book1, Department1 = J.Department1, Direction1 = J.Direction1, Book2 = J.Book2, Department2 = J.Department2, Direction2 = J.Direction2, Book3 = J.Book3, Department3 = J.Department3, Direction3 = J.Direction3, TeamUnit = J.TeamUnit, InqId = J.InqId, AppointTime = J.AppointTime, ComId = J.ComId, CusId = J.CusId, SJobRefNo = J.SJobRefNo, SConId = J.SConId, CusPhone = J.CusPhone }); ctx.SaveChanges(); } }
// GET api/SPCalendar?jobdate1&jobdate2 public string GetBetween(DateTime jobdate1, DateTime jobdate2) { string json; using (var ctx = new SPModel()) { var JobList = ctx.Jobs.Where(d => d.JobDate > jobdate1 && d.JobDate < jobdate2).ToList(); json = JsonConvert.SerializeObject(JobList); } return(json); }
// DELETE api/SPCalendar?jobid public void Delete(int JobID) { using (var ctx = new SPModel()) { var del = ctx.Jobs.Where(ji => (ji.JobID == JobID)).FirstOrDefault(); if (del != null) { ctx.Jobs.Remove(del); } } }
// GET api/SPCalendar?jobdate public string GetDate(DateTime jobdate) { string json; using (var ctx = new SPModel()) { var JobList = ctx.Jobs.Where(d => d.JobDate == jobdate).ToList(); json = JsonConvert.SerializeObject(JobList); } return(json); }
public long AddNewSP(SPModel sp) { try { return(entityData.AddNewSP(sp)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public string GetUser(string username, string password) { string json; using (var ctx = new SPModel()) { var UserList = ctx.Employees.Where(np => np.UserName == username && np.Password == password).ToList(); json = JsonConvert.SerializeObject(UserList); } return(json); }
// DELETE api/SPUser?EmID public void Delete(int EmID) { using (var ctx = new SPModel()) { var del = ctx.Employees.Where(ei => (ei.EmID == EmID)).FirstOrDefault(); if (del != null) { ctx.Employees.Remove(del); } } }
protected override void ProcessRecord() { base.ProcessRecord(); try { SPModel item = (SPModel)this.Manager.Create(this.Descriptor.ModelType); UpdateModelFromParameters(item); this.Manager.CommitChanges(); WriteObject(item); } catch (Exception ex) { ThrowTerminatingError(ex, ErrorCategory.NotSpecified); } }
public int GetCheckLogin(string username, string password) { int count; using (var ctx = new SPModel()) { var UserList = ctx.Employees.Where(np => np.UserName == username && np.Password == password).ToList(); if (UserList != null) { count = 1; } else { count = 0; } } return(count); }
public ISPModel Create( IConstraintElementsAbstractFactory constraintElementsAbstractFactory, IConstraintsAbstractFactory constraintsAbstractFactory, ICrossJoinElementsAbstractFactory crossJoinElementsAbstractFactory, ICrossJoinsAbstractFactory crossJoinsAbstractFactory, IDependenciesAbstractFactory dependenciesAbstractFactory, IIndexElementsAbstractFactory indexElementsAbstractFactory, IIndicesAbstractFactory indicesAbstractFactory, IObjectiveFunctionsAbstractFactory objectiveFunctionsAbstractFactory, IParameterElementsAbstractFactory parameterElementsAbstractFactory, IParametersAbstractFactory parametersAbstractFactory, IVariablesAbstractFactory variablesAbstractFactory, ISPInputContext SPInputContext) { ISPModel model = null; try { model = new SPModel( constraintElementsAbstractFactory, constraintsAbstractFactory, crossJoinElementsAbstractFactory, crossJoinsAbstractFactory, dependenciesAbstractFactory, indexElementsAbstractFactory, indicesAbstractFactory, objectiveFunctionsAbstractFactory, parameterElementsAbstractFactory, parametersAbstractFactory, variablesAbstractFactory, SPInputContext); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(model); }
protected void UpdateModelFromParameters(SPModel item) { foreach (RuntimeDefinedParameter parameter in modelParameters.Values) { if (parameter.IsSet) { PropertyInfo property = base.Descriptor.ModelType.GetProperty(parameter.Name); if (property.PropertyType.IsOf(typeof(IList))) { IList list = (IList)property.GetValue(item, null); foreach (object value in (IList)parameter.Value) { list.Add(value); } } else { property.SetValue(item, parameter.Value, null); } } } }
public TaxonomyNavigationRequestContext() { this.context = TaxonomyNavigationContext.Current; this.variation = VariationContext.Current; if (context.HasNavigationContext) { this.navigationTerm = context.NavigationTerm; } else { using (new SPSecurity.GrantAdditionalPermissionsInScope(SPBasePermissions.FullMask)) { SPWeb currentWeb = SPContext.Current.Web; string url = TaxonomyNavigationHelper.ResolveFriendlyUrl(currentWeb, SPUrlUtility.CombineUrl(currentWeb.ServerRelativeUrl, currentWeb.RootFolder.WelcomePage)); TaxonomyNavigationHelper.TryGetNavigationTerm(url, out this.navigationTerm, out url); } } if (this.navigationTerm == null) { NavigationTermSet termSet; TaxonomyNavigationHelper.IsRequestingNavigationTermSet(out termSet); this.navigationTermSetItem = termSet; } else { this.navigationTermSetItem = navigationTerm; } if (context.HasFriendlyUrl || context.HasCatalogUrl) { this.serverRelativeRequestUrl = context.ResolvedDisplayUrl; } else if (navigationTermSetItem != null) { this.serverRelativeRequestUrl = navigationTermSetItem.GetResolvedDisplayUrl(null); } else { this.serverRelativeRequestUrl = SPUtility.OriginalServerRelativeRequestPath; } this.variationRelativeRequestUrl = PublishingWebHelper.TrimVariationFromPath(serverRelativeRequestUrl); this.query = HttpUtility.ParseQueryString(HttpContext.Current.Request.Url.Query); query.Remove(null); query.Remove("TermStoreId"); query.Remove("TermSetId"); query.Remove("TermId"); this.queryString = query.AllKeys.Length > 0 ? "?" + query : String.Empty; SPListItem listItem = SPContext.Current.ListItem; if (listItem != null) { this.currentItem = SPModel.TryCreate(listItem); } if (currentItem is ICatalogPage) { ICatalogPageFilter filter = CommonHelper.AccessNotNull(((ICatalogPage)currentItem).Filter, "Filter"); SetCatalogPageFilter(filter); } if (currentItem is ISeoMetaProvider) { seoMeta.Add((ISeoMetaProvider)currentItem); } seoMeta.Add(new SeoMetaListItem(listItem)); for (NavigationTerm t = navigationTerm; t != null; t = t.Parent) { seoMeta.Add(new SeoMetaNavigationTerm(listItem.Web, t)); } }