Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //fill suppliers dropDown
                if (ddlSuppliers.Items.Count == 0)
                {
                    List <AppSupplier> suppliers = AppSupplierCollection.FetchAll();
                    foreach (var item in suppliers)
                    {
                        ddlSuppliers.Items.Add(new ListItem(item.BusinessName, item.SupplierId.ToString()));
                    }
                }
                //fill isSendReceived dropdown
                if (ddlIsSendReceived.Items.Count == 0)
                {
                    ddlIsSendReceived.Items.Add(new ListItem(OrdersStrings.GetText(@"yes"), true.ToString()));
                    ddlIsSendReceived.Items.Add(new ListItem(OrdersStrings.GetText(@"no"), false.ToString()));
                }
                //fill status dropdown
                if (ddlStatus.Items.Count == 0)
                {
                    string[] names  = Enum.GetNames(typeof(OrderStatus));
                    Array    values = Enum.GetValues(typeof(OrderStatus));
                    for (int i = 0; i < names.Length; i++)
                    {
                        ddlStatus.Items.Add(new ListItem(OrdersStrings.GetText(names[i]), ((int)values.GetValue(i)).ToString()));
                    }
                }
                //fill payement status dropdown
                if (ddlPaymentStatus.Items.Count == 0)
                {
                    string[] names  = Enum.GetNames(typeof(PaymentStatus));
                    Array    values = Enum.GetValues(typeof(PaymentStatus));
                    for (int i = 0; i < names.Length; i++)
                    {
                        ddlPaymentStatus.Items.Add(new ListItem(OrdersStrings.GetText(names[i]), ((int)values.GetValue(i)).ToString()));
                    }
                }
                LoadItems();
            }
            int CurrentPageIndex = 0;

            if (!int.TryParse(hfCurrentPageIndex_dgOrders.Value, out CurrentPageIndex))
            {
                CurrentPageIndex = 0;
            }
            if (CurrentPageIndex < 0)
            {
                CurrentPageIndex = 0;
            }
            dgOrders.CurrentPageIndex = CurrentPageIndex;
        }
        static public void SendEmailNewProductToSupplier(Product product)
        {
            string        Key        = Settings.Keys.EMAIL_NEW_PRODUCT;
            int           TemplateId = GetEmailTemplateIdFromSettingKey(Key, "he-IL");
            EmailTemplate template   = TemplateId == 0 ? null : EmailTemplateController.GetItem(TemplateId);

            if (template != null)
            {
                string fromEmail    = template.FromEmail;
                string fromName     = template.FromName;
                string replyToEmail = template.ReplyToEmail;
                string replyToName  = template.ReplyToName;
                if (string.IsNullOrEmpty(fromEmail))
                {
                    fromEmail = Settings.GetSetting(Settings.Keys.DEFAULT_EMAIL_FROM);
                }
                if (string.IsNullOrEmpty(fromName))
                {
                    fromName = Settings.GetSetting(Settings.Keys.DEFAULT_EMAIL_FROM_NAME);
                }
                if (string.IsNullOrEmpty(replyToEmail))
                {
                    replyToEmail = Settings.GetSetting(Settings.Keys.ADMIN_EMAIL);
                }

                Dictionary <string, string> dictFieldHtml = new Dictionary <string, string>();
                dictFieldHtml.Add(@"PRODUCTNAME", product.ProductName);
                dictFieldHtml.Add(@"PRODUCTDESCIPTION", product.Description);
                dictFieldHtml.Add(@"PRODUCTCODE", product.ProductCode);

                string subject = EmailTemplateController.ReplaceSharpsInString(template.Subject, dictFieldHtml);

                string body = EmailTemplateController.ReplaceSharpsInString(template.Body, dictFieldHtml);

                string to = "";
                Query  q  = Query.New <AppSupplier>().Where(AppSupplier.Columns.IsDeleted, false);
                AppSupplierCollection col   = AppSupplierCollection.FetchByQuery(q);
                List <string>         lstTo = null;
                if (col != null)
                {
                    lstTo = col.Where(r => r.Email != null).Select(r => r.Email).ToList <string>();
                }
                if (to != "" || lstTo != null)
                {
                    System.Net.Mail.MailMessage message = EmailTemplateController.BuildMailMessage(
                        fromEmail, fromName, replyToEmail, replyToName,
                        to, template.CcList, template.BccList, subject, body, null, template.MailPriority, lstTo);
                    EmailTemplateController.Send(message, EmailLogController.EmailLogType.OnError, true);
                }
            }
        }
Example #3
0
        public static void SendNotificationNewMessage(string Message)
        {
            Dictionary <string, object> additionalInfo = new Dictionary <string, object>();

            additionalInfo[@"message"] = Message;

            Query q = Query.New <AppSupplier>()
                      .Where(AppSupplier.Columns.IsDeleted, false);

            foreach (AppSupplier item in AppSupplierCollection.FetchByQuery(q))
            {
                BadgeCountForSupplier(item.SupplierId, 1);
                SendNotificationMessage(item.SupplierId, Message, @"new-message", null, GetBadgeCountForSupplier(item.SupplierId), null, @"new-message", additionalInfo);
            }
        }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HasEditPermission = Permissions.PermissionsForUser(SessionHelper.UserId()).Contains(Permissions.PermissionKeys.sys_perm);



        if (ddlSuppliers.Items.Count == 0)
        {
            List <AppSupplier> suppliers = AppSupplierCollection.FetchAll();
            foreach (var item in suppliers)
            {
                ddlSuppliers.Items.Add(new ListItem(item.BusinessName, item.SupplierId.ToString()));
            }
        }
        ddlSuppliers.DataBind();
    }
Example #5
0
    private List <ListItem> getSuppliersList()
    {
        List <AppSupplier> suppliers = AppSupplierCollection.FetchAll();
        List <ListItem>    items     = suppliers.Where(s => s.IsDeleted == false && s.IsLocked == false && s.IsService == true)
                                       .Select(s => new ListItem {
            Value = s.SupplierId.ToString(), Text = s.BusinessName
        }).ToList();
        List <ListItem> ddlData = new List <ListItem>();

        ddlData.Add(new ListItem()
        {
            Value = "0", Text = Snoopi.web.Resources.PromotedArea.ResourceManager.GetString("NoSelection")
        });
        foreach (var item in items)
        {
            ddlData.Add(item);
        }
        return(ddlData);
    }