当前位置: 首页>>代码示例>>C#>>正文


C# Models.FormContext类代码示例

本文整理汇总了C#中Tingle_WebForms.Models.FormContext的典型用法代码示例。如果您正苦于以下问题:C# FormContext类的具体用法?C# FormContext怎么用?C# FormContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FormContext类属于Tingle_WebForms.Models命名空间,在下文中一共展示了FormContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetUserStatuses

        public IEnumerable<UserStatus> GetUserStatuses()
        {
            using (FormContext ctx = new FormContext())
            {
                var StatusList = ctx.UserStatuses.ToList();

                return StatusList;
            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:9,代码来源:Site.Master.cs

示例2: FillEmailAddressLabels

        public void FillEmailAddressLabels()
        {
            List<String> listEmails = new List<String>();

            if (cbNotifyStandard.Checked)
            {
                using (FormContext ctx = new FormContext())
                {
                    if (ctx.InventoryNotificationEmailAddresses.Any(x => x.Status == 1))
                    {
                        ICollection<InventoryNotificationEmails> emailAddresses = ctx.InventoryNotificationEmailAddresses.Where(x => x.Status == 1).ToList();

                        if (emailAddresses.Count() > 0)
                        {
                            foreach (InventoryNotificationEmails email in emailAddresses)
                            {
                                listEmails.Add(email.Address);
                            }
                        }
                    }
                }
            }

            if (cbNotifyOther.Checked)
            {
                var notifyOtherList = ddlNotifyOther.CheckedItems;

                if (notifyOtherList.Any())
                {
                    foreach (var item in notifyOtherList)
                    {
                        if (item.Text != null)
                        {
                            listEmails.Add(item.Text);
                        }
                    }
                }

            }

            string emailList = "";

            foreach (string email in listEmails)
            {
                emailList += email + ", ";
            }

            if (emailList.Length >= 2)
            {
                if (emailList.Substring(emailList.Length - 2, 2) == ", ")
                {
                    emailList = emailList.Substring(0, emailList.Length - 2);
                }
            }

            lblEmailsSentTo.Text = emailList;
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:57,代码来源:InventoryApproval.aspx.cs

示例3: SendInventoryNotification

        public Boolean SendInventoryNotification(List<string> emailList, string bodyHtml, SystemUsers sentUser)
        {
            try
            {
                MailMessage completeMessage = new MailMessage();
                completeMessage.From = new MailAddress("[email protected]");
                completeMessage.Subject = "Inventory Approval Notification";
                completeMessage.Body = bodyHtml;
                completeMessage.IsBodyHtml = true;

                //SmtpClient client = new SmtpClient("TingleNT30.wctingle.com");
                //client.UseDefaultCredentials = true;
                SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                client.Credentials = new NetworkCredential("[email protected]", "ZXCasdQWE123!");
                client.EnableSsl = true;

                using (FormContext ctx = new FormContext())
                {
                    foreach (string email in emailList)
                    {
                        InventoryApprovalNotifications newRN = new InventoryApprovalNotifications
                        {
                            BodyHtml = bodyHtml,
                            SentBy = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == sentUser.SystemUserID),
                            Status = 0,
                            Timestamp = DateTime.Now,
                            ToEmailAddress = email
                        };

                        ctx.InventoryApprovalNotifications.Add(newRN);
                        ctx.SaveChanges();

                        try
                        {
                            completeMessage.To.Clear();
                            completeMessage.To.Add(email);
                            client.Send(completeMessage);

                            newRN.Status = 1;

                            ctx.SaveChanges();
                        }
                        catch (Exception exc)
                        { }

                    }
                }

                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:55,代码来源:SendEmail.cs

示例4: Application_Start

 void Application_Start(object sender, EventArgs e)
 {
     // Code that runs on application startup
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     AuthConfig.RegisterOpenAuth();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     Database.SetInitializer(new MigrateDatabaseToLatestVersion<FormContext, Configuration>());
     using (FormContext temp = new FormContext())
     {
         temp.Database.Initialize(true);
     }
 }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:12,代码来源:Global.asax.cs

示例5: HasBeenAssigned

 public bool HasBeenAssigned(SystemUsers user, Int32 formId, string formName)
 {
     try
     {
         using (FormContext context = new FormContext())
         {
             return context.UserAssignments.Any(x => x.User.SystemUserID == user.SystemUserID && x.RelatedFormId == formId && x.Form.FormName == formName);
         }
     }
     catch (Exception ex)
     {
         return false;
     }
 }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:14,代码来源:UserLogic.cs

示例6: HasAccess

 public bool HasAccess(SystemUsers user, string formName)
 {
     try
     {
         using (FormContext ctx = new FormContext())
         {
             return ctx.FormPermissions.Any(x => x.Enabled == true && x.FormName == formName && x.UserRole.UserRoleId == user.UserRole.UserRoleId);
         }
     }
     catch (Exception ex)
     {
         return false;
     }
 }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:14,代码来源:UserLogic.cs

示例7: AddExpeditedOrderForm

        public bool AddExpeditedOrderForm(string oowOrderNumber, string customer, string accountNumber, ExpediteCode expediteCode, string purchaseOrderNumber, string materialSku, string quantityOrdered,
            Nullable<DateTime> installDate, string sM, string contactName, string phoneNumber, string shipToName, string shipToAddress, string shipToCity, string shipToState, string shipToZip,
            string additionalInfo, Status status, string submittedByUser, string ccFormToEmail, string company, out Int32 formId)
        {
            try
            {
                using (FormContext _db = new FormContext())
                {
                    var expCode = _db.ExpediteCodes.SingleOrDefault(ec => ec.ExpediteCodeID == expediteCode.ExpediteCodeID);
                    var submissionStatus = _db.Statuses.SingleOrDefault(s => s.StatusId == status.StatusId);

                    var newForm = new ExpeditedOrderForm();
                    newForm.Timestamp = DateTime.Now;
                    newForm.OowOrderNumber = oowOrderNumber;
                    newForm.Customer = customer;
                    newForm.AccountNumber = accountNumber;
                    newForm.ExpediteCode = expCode;
                    newForm.PurchaseOrderNumber = purchaseOrderNumber;
                    newForm.InstallDate = installDate;
                    newForm.SM = sM;
                    newForm.ContactName = contactName;
                    newForm.PhoneNumber = phoneNumber;
                    newForm.ShipToName = shipToName;
                    newForm.ShipToAddress = shipToAddress;
                    newForm.ShipToCity = shipToCity;
                    newForm.ShipToState = shipToState;
                    newForm.ShipToZip = shipToZip;
                    newForm.AdditionalInfo = additionalInfo;
                    newForm.Status = submissionStatus;
                    newForm.SubmittedByUser = submittedByUser;
                    newForm.CCFormToEmail = ccFormToEmail;
                    newForm.Company = company;

                    _db.ExpeditedOrderForms.Add(newForm);
                    _db.SaveChanges();

                    formId = newForm.RecordId;
                }
                return true;
            }
            catch (Exception ex)
            {
                formId = 0;
                return false;
                //throw ex;

            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:48,代码来源:AddExpeditedOrderForm.cs

示例8: fvEmailInsert_InsertItem

        public void fvEmailInsert_InsertItem()
        {
            try
            {
                TextBox txtNameInsert = (TextBox)fvEmailInsert.FindControl("txtNameInsert");
                TextBox txtAddressInsert = (TextBox)fvEmailInsert.FindControl("txtAddressInsert");
                RadioButtonList rblCompanyInsert = (RadioButtonList)fvEmailInsert.FindControl("rblCompanyInsert");
                RadioButtonList rblStatusInsert = (RadioButtonList)fvEmailInsert.FindControl("rblStatusInsert");
                Int16 status = Convert.ToInt16(rblStatusInsert.SelectedValue);
                int id = Convert.ToInt32(ddlFormName.SelectedValue);

                using (FormContext ctx = new FormContext())
                {
                    var tForm = ctx.TForms.Where(f => f.FormID == id).FirstOrDefault();

                    EmailAddress newEmail = new EmailAddress();

                    newEmail.Name = txtNameInsert.Text;
                    newEmail.Address = txtAddressInsert.Text;
                    newEmail.Company = rblCompanyInsert.SelectedValue;
                    newEmail.Status = status;
                    newEmail.TForm = tForm;
                    newEmail.Timestamp = DateTime.Now;

                    ctx.EmailAddresses.Add(newEmail);

                    if (ModelState.IsValid)
                    {
                        ctx.SaveChanges();
                        gvEmailList.DataBind();
                    }

                    lblEmailMessage.Text = "";
                }
            }
            catch (Exception ex)
            {
                lblEmailMessage.Text = "Unable to insert new Email Address.  Please contact your system administrator.";
            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:40,代码来源:Administration.aspx.cs

示例9: btnSubmit_Click

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    Int32 formId;
                    int statusId;
                    DateTime tryDueDate;
                    Nullable<DateTime> dueDate = null;
                    string emailListString = lblEmailsSentTo.Text.Replace(" ", "");
                    List<string> emailList = emailListString.Split(',').ToList<string>();

                    System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User;
                    UserLogic uLogic = new UserLogic();
                    SystemUsers currentUser = uLogic.GetCurrentUser(user);

                    statusId = Convert.ToInt32(ddlStatus.SelectedValue);

                    if (txtDueByDate.Value != "")
                    {
                        DateTime.TryParse(txtDueByDate.Value, out tryDueDate);

                        if (tryDueDate.Year > 0001)
                        {
                            dueDate = tryDueDate;
                        }
                    }
                    else
                    {
                        dueDate = null;
                    }

                    using (FormContext ctx = new FormContext())
                    {
                        var status = ctx.Statuses.Where(s => s.StatusId.Equals(statusId)).FirstOrDefault();
                        Int32 requestedUserId = Convert.ToInt32(ddlRequestedBy.SelectedValue);
                        var requestedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedUserId);
                        var modifiedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID);

                        Models.LowInventoryForm newForm = new Models.LowInventoryForm
                        {
                            Timestamp = DateTime.Now,
                            Company = ddlCompany.SelectedValue,
                            OrderNumber = txtOrderNumber.Text,
                            Plant = ctx.Plants.FirstOrDefault(x => x.PlantText == ddlPlants.SelectedText),
                            Line = txtLine.Text,
                            Quantity = txtQuantity.Text,
                            SKU = txtSKU.Text,
                            Status = ctx.Statuses.FirstOrDefault(s => s.StatusText == ddlStatus.SelectedItem.Text),
                            RequestedUser = requestedUser,
                            LastModifiedUser = modifiedUser,
                            SubmittedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID),
                            DueDate = dueDate,
                            Priority = ctx.Priorities.FirstOrDefault(x => x.PriorityText == ddlPriority.SelectedText),
                            LastModifiedTimestamp = DateTime.Now
                        };

                        if (ddlAssignedTo.SelectedIndex != -1)
                        {
                            Int32 assignedUserId = Convert.ToInt32(ddlAssignedTo.SelectedValue);
                            newForm.AssignedUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedUserId);
                        }

                        ctx.LowInventoryForms.Add(newForm);
                        ctx.SaveChanges();

                        if (newForm.AssignedUser != null)
                        {
                            Int32 assignedUserId = Convert.ToInt32(ddlAssignedTo.SelectedValue);

                            UserAssignmentAssociation uA = new UserAssignmentAssociation
                            {
                                Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"),
                                RelatedFormId = newForm.RecordId,
                                User = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedUserId)
                            };

                            ctx.UserAssignments.Add(uA);
                        }

                        if (newForm.RequestedUser != null)
                        {
                            UserRequestAssociation uR = new UserRequestAssociation
                            {
                                Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"),
                                RelatedFormId = newForm.RecordId,
                                User = requestedUser
                            };

                            ctx.UserRequests.Add(uR);
                        }

                        ctx.SaveChanges();

                        formId = newForm.RecordId;

                        Comments systemComment = new Comments
                        {
                            Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Low Inventory"),
//.........这里部分代码省略.........
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:101,代码来源:LowInventoryForm.aspx.cs

示例10: GetPOStatuses

        public IEnumerable<PurchaseOrderStatus> GetPOStatuses()
        {
            using (FormContext ctx = new FormContext())
            {
                var StatusList = ctx.POStatuses.ToList();

                return StatusList;
            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:9,代码来源:OrderCancellationForm.aspx.cs

示例11: FillEmailAddressLabels

        public void FillEmailAddressLabels()
        {
            lblNotifyAssigneeValue.Text = ddlAssignedTo.SelectedIndex != -1 ? ddlAssignedTo.SelectedItem.Text : "";
            lblNotifyRequesterValue.Text = ddlRequestedBy.SelectedIndex != -1 ? ddlRequestedBy.SelectedItem.Text : "";
            lblNotifyStandardValue.Text = ddlCompany.SelectedText;

            List<String> listEmails = new List<String>();

            if (cbNotifyStandard.Checked)
            {
                using (FormContext ctx = new FormContext())
                {
                    if (ctx.EmailAddresses.Any(x => x.Status == 1 && x.TForm.FormName == "Low Inventory" && x.Company == ddlCompany.SelectedText))
                    {
                        ICollection<EmailAddress> emailAddresses = ctx.EmailAddresses.Where(x => x.Status == 1 && x.TForm.FormName == "Low Inventory" && x.Company == ddlCompany.SelectedText).ToList();

                        if (emailAddresses.Count() > 0)
                        {
                            foreach (EmailAddress email in emailAddresses)
                            {
                                listEmails.Add(email.Address);
                            }
                        }
                    }
                }
            }

            if (cbNotifyAssignee.Checked)
            {
                if (lblNotifyAssigneeValue.Text != "")
                {
                    listEmails.Add(lblNotifyAssigneeValue.Text);
                }
            }

            if (cbNotifyRequester.Checked)
            {
                if (lblNotifyRequesterValue.Text != "")
                {
                    listEmails.Add(lblNotifyRequesterValue.Text);
                }
            }

            if (cbNotifyOther.Checked)
            {
                var notifyOtherList = ddlNotifyOther.CheckedItems;

                if (notifyOtherList.Any())
                {
                    foreach (var item in notifyOtherList)
                    {
                        if (item.Text != null)
                        {
                            listEmails.Add(item.Text);
                        }
                    }
                }

            }

            string emailList = "";

            foreach (string email in listEmails)
            {
                emailList += email + ", ";
            }

            if (emailList.Length >= 2)
            {
                if (emailList.Substring(emailList.Length - 2, 2) == ", ")
                {
                    emailList = emailList.Substring(0, emailList.Length - 2);
                }
            }

            lblEmailsSentTo.Text = emailList;
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:77,代码来源:LowInventoryForm.aspx.cs

示例12: btnAddComment_Click

        protected void btnAddComment_Click(object sender, EventArgs e)
        {
            try
            {
                Label lblRecordId = (Label)fvReport.FindControl("lblRecordId");
                int recordId;
                Int32.TryParse(lblRecordId.Text, out recordId);
                RadTextBox txtNewComment = (RadTextBox)fvReport.FindControl("txtNewComment");
                Repeater rptrComments = (Repeater)fvReport.FindControl("rptrComments");

                UserLogic newLogic = new UserLogic();

                System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User;
                SystemUsers currentUser = newLogic.GetCurrentUser(user);

                using (var ctx = new FormContext())
                {
                    var thisForm = ctx.MustIncludeForms.FirstOrDefault(eof => eof.RecordId == recordId);

                    Comments newComment = new Comments
                    {
                        Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"),
                        Note = txtNewComment.Text,
                        RelatedFormId = thisForm.RecordId,
                        SystemComment = false,
                        Timestamp = DateTime.Now,
                        User = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID)
                    };

                    ctx.Comments.Add(newComment);
                    ctx.SaveChanges();

                    txtNewComment.Text = "";
                    txtNewComment.Invalid = false;

                    rptrComments.DataBind();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:43,代码来源:ReportMustInclude.aspx.cs

示例13: ddlCompanyEdit_DataBinding

        protected void ddlCompanyEdit_DataBinding(object sender, EventArgs e)
        {
            try
            {
                RadDropDownList ddlCompanyEdit = (RadDropDownList)sender;
                Label lblRecordId = (Label)fvReport.FindControl("lblRecordId");
                int recordId;
                Int32.TryParse(lblRecordId.Text, out recordId);

                using (var ctx = new FormContext())
                {
                    var thisForm = ctx.MustIncludeForms.FirstOrDefault(eof => eof.RecordId == recordId);

                    ddlCompanyEdit.SelectedValue = thisForm.Company;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:21,代码来源:ReportMustInclude.aspx.cs

示例14: GetWarehouses

        public IEnumerable<Warehouse> GetWarehouses()
        {
            using (FormContext ctx = new FormContext())
            {
                var whList = ctx.Warehouses.ToList();

                return whList;
            }
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:9,代码来源:ReportMustInclude.aspx.cs

示例15: FillEmailAddressLabels

        public void FillEmailAddressLabels()
        {
            Label lblNotifyAssigneeValue = (Label)fvReport.FindControl("lblNotifyAssigneeValue");
            Label lblNotifyRequesterValue = (Label)fvReport.FindControl("lblNotifyRequesterValue");
            Label lblNotifyStandardValue = (Label)fvReport.FindControl("lblNotifyStandardValue");
            Label lblEmailsSentTo = (Label)fvReport.FindControl("lblEmailsSentTo");
            RadComboBox ddlAssignedToEdit = (RadComboBox)fvReport.FindControl("ddlAssignedToEdit");
            RadComboBox ddlRequestedByEdit = (RadComboBox)fvReport.FindControl("ddlRequestedByEdit");
            RadDropDownList ddlCompanyEdit = (RadDropDownList)fvReport.FindControl("ddlCompanyEdit");
            RadComboBox ddlNotifyOther = (RadComboBox)fvReport.FindControl("ddlNotifyOther");
            CheckBox cbNotifyStandard = (CheckBox)fvReport.FindControl("cbNotifyStandard");
            CheckBox cbNotifyAssignee = (CheckBox)fvReport.FindControl("cbNotifyAssignee");
            CheckBox cbNotifyRequester = (CheckBox)fvReport.FindControl("cbNotifyRequester");
            CheckBox cbNotifyOther = (CheckBox)fvReport.FindControl("cbNotifyOther");

            lblNotifyAssigneeValue.Text = ddlAssignedToEdit.SelectedIndex != -1 ? ddlAssignedToEdit.SelectedItem.Text : "";
            lblNotifyRequesterValue.Text = ddlRequestedByEdit.SelectedIndex != -1 ? ddlRequestedByEdit.SelectedItem.Text : "";
            lblNotifyStandardValue.Text = ddlCompanyEdit.SelectedText;

            List<String> listEmails = new List<String>();

            if (cbNotifyStandard.Checked)
            {
                using (FormContext ctx = new FormContext())
                {
                    if (ctx.EmailAddresses.Any(x => x.Status == 1 && x.TForm.FormName == "Must Include" && x.Company == ddlCompanyEdit.SelectedText))
                    {
                        ICollection<EmailAddress> emailAddresses = ctx.EmailAddresses.Where(x => x.Status == 1 && x.TForm.FormName == "Must Include" && x.Company == ddlCompanyEdit.SelectedText).ToList();

                        if (emailAddresses.Count() > 0)
                        {
                            foreach (EmailAddress email in emailAddresses)
                            {
                                listEmails.Add(email.Address);
                            }
                        }
                    }
                }
            }

            if (cbNotifyAssignee.Checked)
            {
                if (lblNotifyAssigneeValue.Text != "")
                {
                    listEmails.Add(lblNotifyAssigneeValue.Text);
                }
            }

            if (cbNotifyRequester.Checked)
            {
                if (lblNotifyRequesterValue.Text != "")
                {
                    listEmails.Add(lblNotifyRequesterValue.Text);
                }
            }

            if (cbNotifyOther.Checked)
            {
                var notifyOtherList = ddlNotifyOther.CheckedItems;

                if (notifyOtherList.Any())
                {
                    foreach (var item in notifyOtherList)
                    {
                        if (item.Text != null)
                        {
                            listEmails.Add(item.Text);
                        }
                    }
                }

            }

            string emailList = "";

            foreach (string email in listEmails)
            {
                emailList += email + ", ";
            }

            if (emailList.Length >= 2)
            {
                if (emailList.Substring(emailList.Length - 2, 2) == ", ")
                {
                    emailList = emailList.Substring(0, emailList.Length - 2);
                }
            }

            lblEmailsSentTo.Text = emailList;
        }
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:90,代码来源:ReportMustInclude.aspx.cs


注:本文中的Tingle_WebForms.Models.FormContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。