Пример #1
0
 private void HandleAlertMessage(AlertMessage message)
 {
     Dispatcher.BeginInvoke((Action<AlertMessage>)((m) =>
     {
         System.Windows.MessageBox.Show(m.Message);
     }), message);
 }
Пример #2
0
        private static void AddMessageToTempData(ControllerBase controller, AlertType type, string title, string message)
        {
            var alertMessage = new AlertMessage
            {
                Title = title,
                Message = message,
                CssClass = type.CssClass
            };

            controller.TempData["alert"] = alertMessage.AsJson();
        }
Пример #3
0
        public static MvcHtmlString RenderAlert(this HtmlHelper helper)
        {
            object alertData = helper.ViewContext.TempData["alert"];

            if (alertData == null)
                return MvcHtmlString.Empty;

            var alert = new AlertMessage(alertData.ToString());

            if (String.IsNullOrEmpty(alert.Message) && String.IsNullOrEmpty(alert.Title))
                return MvcHtmlString.Empty;
            return
                new MvcHtmlString(String.Format(
                    "<div class='alert alert-{0} alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><strong>{1}</strong>{2}</div>",
                    alert.CssClass, HttpUtility.HtmlEncode(alert.Title), HttpUtility.HtmlEncode(alert.Message)));
        }
Пример #4
0
        public AlertMessage Edit(SupervisorViewModel model)
        {
            AlertMessage alert = new AlertMessage();

            if (!IsAccessible(ModuleCode.Supervisor))
            {
                alert.Text = StaticMessage.ERR_ACCESS_DENIED;
                return(alert);
            }

            if (!IsEditable())
            {
                alert.Text = StaticMessage.ERR_ACCESS_DENIED;
                return(alert);
            }

            IRepository <FSS> repo = _unitOfWork.GetRepository <FSS>();

            repo.Condition = PredicateBuilder.True <FSS>().And(x => x.NIK == model.NIK);

            FSS item = repo.Find().FirstOrDefault();

            if (item == null)
            {
                alert.Text = StaticMessage.ERR_DATA_NOT_FOUND;
                return(alert);
            }

            DateTime now = DateTime.UtcNow.ToUtcID();

            item.FullName = model.Fullname;
            //item.Role = model.IsRole;
            item.DefaultRayonType = model.DefaultRayonType;
            item.ValidFrom        = DateTime.Parse(model.FormattedValidFrom);
            item.ValidTo          = DateTime.Parse(model.FormattedValidTo);
            item.UpdatedBy        = _userAuth.NIK.ToString();
            item.UpdatedOn        = now;

            try
            {
                _unitOfWork.BeginTransaction();

                repo.Update(item);

                _unitOfWork.Commit();

                alert.Status = 1;
                alert.Text   = string.Format(StaticMessage.SCS_EDIT, item.NIK, item.FullName);
            }
            catch (Exception ex)
            {
                _logger.Write("error", DateTime.Now, ex.Message, _userAuth.Fullname, ex);
                alert.Text = StaticMessage.ERR_SAVE_FAILED;
            }
            finally
            {
                _unitOfWork.Dispose();
            }

            return(alert);
        }
Пример #5
0
Файл: Spec.cs Проект: qdjx/C5
        //更新信息
        public static SpecInfo SpecInfoUpload(SpecInfo specInfo, List <string> specValues, out AlertMessage alertMessage)
        {
            //权限检查
            if (!AUTH.PermissionCheck(ModuleInfo, ActionInfos.Where(i => i.Name == (specInfo.ID == 0 ? "Create" : "Modify")).FirstOrDefault(), out string Message))
            {
                alertMessage = new AlertMessage {
                    Message = Message, Type = AlertType.warning
                };
                return(null);
            }

            //表单检查
            if (string.IsNullOrWhiteSpace(specInfo.Name))
            {
                alertMessage = new AlertMessage {
                    Message = "规格代码不能为空。", Type = AlertType.warning
                };
                return(null);
            }
            if (string.IsNullOrWhiteSpace(specInfo.Title))
            {
                alertMessage = new AlertMessage {
                    Message = "规格名称不能为空。", Type = AlertType.warning
                };
                return(null);
            }

            using (var EF = new EF())
            {
                //修改是否存在?规格代码、名称唯一?
                SpecInfo spec_exist       = null;
                SpecInfo spec_name_exist  = null;
                SpecInfo spec_title_exist = null;
                if (specInfo.ID == 0)
                {
                    spec_name_exist  = EF.SpecInfos.Where(i => i.Name == specInfo.Name).FirstOrDefault();
                    spec_title_exist = EF.SpecInfos.Where(i => i.Title == specInfo.Title).FirstOrDefault();
                }
                else
                {
                    spec_exist = EF.SpecInfos.Where(i => i.ID == specInfo.ID).FirstOrDefault();
                    if (spec_exist == null)
                    {
                        alertMessage = new AlertMessage {
                            Message = string.Format("规格编号[{0}]不存在。", specInfo.ID), Type = AlertType.warning
                        };
                        return(null);
                    }
                    spec_name_exist  = EF.SpecInfos.Where(i => i.ID != specInfo.ID && i.Name == specInfo.Name).FirstOrDefault();
                    spec_title_exist = EF.SpecInfos.Where(i => i.ID != specInfo.ID && i.Title == specInfo.Title).FirstOrDefault();
                }
                if (spec_name_exist != null && spec_name_exist.ID > 0)
                {
                    alertMessage = new AlertMessage {
                        Message = string.Format("规格代码[{0}]已被ID[{1}]使用。", specInfo.Name, spec_name_exist.ID), Type = AlertType.warning
                    };
                    return(null);
                }
                if (spec_title_exist != null && spec_title_exist.ID > 0)
                {
                    alertMessage = new AlertMessage {
                        Message = string.Format("规格名称[{0}]已被ID[{1}]使用。", specInfo.Title, spec_title_exist.ID), Type = AlertType.warning
                    };
                    return(null);
                }

                //数据保存
                using (TransactionScope TS = new TransactionScope())
                {
                    //规格信息
                    if (specInfo.ID == 0)
                    {
                        spec_exist = EF.SpecInfos.Add(new SpecInfo {
                            Enabled = true
                        });
                    }
                    spec_exist.Name     = specInfo.Name;
                    spec_exist.Title    = specInfo.Title;
                    spec_exist.IconFont = specInfo.IconFont;
                    EF.SaveChanges();

                    //规格参数
                    foreach (var item in specValues)
                    {
                        var specValue_exist = EF.SpecValues.Where(i => i.SpecID == spec_exist.ID && i.Value == item).FirstOrDefault();
                        if (specValue_exist == null)
                        {
                            EF.SpecValues.Add(specValue_exist = new SpecValue {
                                SpecID = spec_exist.ID, Value = item, Enabled = true
                            });
                        }
                        EF.SaveChanges();
                    }
                    TS.Complete();
                }

                //更新完成
                alertMessage = null;
                return(spec_exist);
            }
        }
Пример #6
0
        public AlertMessage Add(SupervisorViewModel model)
        {
            AlertMessage alert = new AlertMessage();

            if (!IsAccessible(ModuleCode.Supervisor))
            {
                alert.Text = StaticMessage.ERR_ACCESS_DENIED;
                return(alert);
            }

            if (!IsEditable())
            {
                alert.Text = StaticMessage.ERR_ACCESS_DENIED;
                return(alert);
            }

            //model.ValidFromDate = DateTime.ParseExact(model.FormattedValidFrom, AppConstant.DefaultFormatDate, _cultureInfo);
            //model.ValidToDate = DateTime.ParseExact(model.FormattedValidTo, AppConstant.DefaultFormatDate, _cultureInfo);

            IRepository <FSS> repo = _unitOfWork.GetRepository <FSS>();
            FSS item = null;

            repo.Condition = PredicateBuilder.True <FSS>().And(x => x.NIK == model.NIK);

            item = repo.Find().FirstOrDefault();

            if (item != null)
            {
                alert.Text = string.Format(StaticMessage.ERR_NIK_EXIST, model.NIK);
                return(alert);
            }

            DateTime now       = DateTime.UtcNow.ToUtcID();
            DateTime validFrom = now.AddMonths(-1).AddDays(1).Date;
            DateTime validTo   = new DateTime(9999, 12, 31);

            item = new FSS()
            {
                NIK              = model.NIK,
                FullName         = model.Fullname,
                Role             = model.IsRole,
                DefaultRayonType = model.DefaultRayonType,
                ValidFrom        = validFrom,
                ValidTo          = validTo,
                CreatedBy        = _userAuth.NIK.ToString(),
                CreatedOn        = now,
                UpdatedBy        = _userAuth.NIK.ToString(),
                UpdatedOn        = now,
            };

            try
            {
                _unitOfWork.BeginTransaction();

                repo.Insert(item);

                _unitOfWork.Commit();

                alert.Status = 1;
                alert.Text   = string.Format(StaticMessage.SCS_ADD_MASTER, model.NIK, model.Fullname);
            }
            catch (Exception ex)
            {
                _logger.Write("error", DateTime.Now, ex.Message, _userAuth.Fullname, ex);
                alert.Text = StaticMessage.ERR_SAVE_FAILED;
            }
            finally
            {
                _unitOfWork.Dispose();
            }

            return(alert);
        }
Пример #7
0
        bool TryUpdateShippingRow(GridViewRow row, string guid)
        {
            var newGuid = DB.GetNewGUID();
            //loop through the colums and update each shipping method with the appropriate value
            var indexCounter = 0;

            foreach (var column in ShippingGrid.Columns)
            {
                //skip past the low and high value columns and make sure we've got a bound field
                if (indexCounter > 1 && column.GetType() == typeof(BoundField))
                {
                    var field = (BoundField)column;
                    if (field.DataField.Contains("MethodAmount_"))
                    {
                        var     methodId = field.DataField.Replace("MethodAmount_", String.Empty);
                        decimal lowValue = 0;
                        if (!decimal.TryParse(((TextBox)(row.Cells[0].Controls[0])).Text, out lowValue))
                        {
                            AlertMessage.PushAlertMessage("Your low value is not in the correct format.", AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                            return(false);
                        }
                        decimal highValue = 0;
                        if (!decimal.TryParse(((TextBox)(row.Cells[1].Controls[0])).Text, out highValue))
                        {
                            AlertMessage.PushAlertMessage("Your high value is not in the correct format.", AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                            return(false);
                        }
                        decimal amount = 0;
                        if (!decimal.TryParse(((TextBox)(row.Cells[indexCounter].Controls[0])).Text, out amount))
                        {
                            AlertMessage.PushAlertMessage("The amount you entered for one of your shipping methods is not in the correct format.", AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                            return(false);
                        }
                        if (lowValue >= highValue)
                        {
                            AlertMessage.PushAlertMessage("Please enter a valid range for your low and high values", AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                            return(false);
                        }
                        //passed validation. delete the old row and create a new one.
                        if (guid != "0")
                        {
                            var deleteParameters = new[] {
                                new SqlParameter("Guid", guid),
                                new SqlParameter("@ZoneId", SelectedZoneId)
                            };
                            DB.ExecuteSQL("delete from ShippingTotalByZone where RowGUID = @Guid and ShippingZoneID = @ZoneId", deleteParameters);
                        }

                        var parameters = new[] {
                            new SqlParameter("@ShippingGuid", newGuid),
                            new SqlParameter("@LowAmount", lowValue),
                            new SqlParameter("@HighAmount", highValue),
                            new SqlParameter("@ShippingMethodId", methodId),
                            new SqlParameter("@ShippingCharge", amount),
                            new SqlParameter("@ZoneId", SelectedZoneId),
                            new SqlParameter("@StoreId", SelectedStoreId),
                        };

                        var insertSql = @"insert into ShippingTotalByZone(RowGUID, LowValue, HighValue, ShippingMethodID, ShippingCharge, ShippingZoneID, StoreID) 
										values(@ShippingGuid, @LowAmount, @HighAmount, @ShippingMethodId, @ShippingCharge, @ZoneId, @StoreId)"                                        ;

                        DB.ExecuteSQL(insertSql, parameters);
                    }
                }
                indexCounter++;
            }
            return(true);
        }
Пример #8
0
        public void LoadDmAlerts()
        {
            var path = Path.Combine(Strings.AlertsFolder, DmAlertsFile);

            DmAlerts = MasterFile.LoadInit <AlertMessage>(path);
        }
Пример #9
0
        private void OnBtnSpListAdd(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            FrmNewSp f;

            try
            {
                if (e.Button.Index == 1)
                {
                    int i = e.Button.Tag.ToInt();

                    switch (i)
                    {
                    case 1:
                        var fm = new FrmNewManufacturer();

                        if (!string.IsNullOrWhiteSpace(drug.PriceManufacturer))
                        {
                            fm.edName.Text = drug.PriceManufacturer;
                        }

                        if (fm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            cbManufacturer.Properties.DataSource = db.Manufacturer.GetSp();
                            AlertMessage.Show("Данные успешно сохранены");
                        }
                        break;

                    case 2:
                        f = new FrmNewSp();
                        if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            var name = f.edName.Text;
                            if (!string.IsNullOrWhiteSpace(name))
                            {
                                var ss = new spDrugCategory();
                                ss.Id         = Guid.NewGuid();
                                ss.Name       = name;
                                ss.Status     = 1;
                                ss.CreateUser = Vars.UserId;
                                ss.CreateDate = DateTime.Now;
                                db.DrugCategory.Add(ss);
                                db.Complete();
                                cbDrugCategory.Properties.DataSource = db.DrugCategory.GetSp();
                                AlertMessage.Show("Данные успешно сохранены");
                            }
                        }
                        f.Dispose();
                        break;

                    case 3:
                        f = new FrmNewSp();
                        if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            var name = f.edName.Text;
                            if (!string.IsNullOrWhiteSpace(name))
                            {
                                var sc = new spPharmGroup();

                                sc.Id         = Guid.NewGuid();
                                sc.Name       = name;
                                sc.Status     = 1;
                                sc.CreateUser = Vars.UserId;
                                sc.CreateDate = DateTime.Now;

                                db.PharmGroup.Add(sc);
                                db.Complete();
                                cbPharmGroup.Properties.DataSource = db.PharmGroup.GetSp();
                                AlertMessage.Show("Данные успешно сохранены");
                            }
                        }
                        f.Dispose();
                        break;

                    case 4:
                        f = new FrmNewSp();
                        if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            var name = f.edName.Text;
                            if (!string.IsNullOrWhiteSpace(name))
                            {
                                var su = new spUnit();
                                su.Name       = name;
                                su.Status     = 1;
                                su.CreateUser = Vars.UserId;
                                su.CreateDate = DateTime.Now;
                                db.Unit.Add(su);
                                db.Complete();
                                cbUnit.Properties.DataSource = db.Unit.GetSp();
                                AlertMessage.Show("Данные успешно сохранены");
                            }
                        }
                        f.Dispose();
                        break;
                    }
                }
            }
            catch (System.Exception ee)
            {
                var li = new LogItem
                {
                    App        = "Sklad",
                    Stacktrace = ee.GetStackTrace(5),
                    Message    = ee.GetAllMessages(),
                    Method     = "FrmProductList.OnBtnSpListAdd"
                };
                CLogJson.Write(li);
                AlertMessage.ShowError("Ошибка при сохранении");
            }
        }
Пример #10
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var alertToComplete = (Alert)obj;

            if (AlertMessage == null)
            {
                if (alertToComplete.AlertMessage != null)
                {
                    return(false);
                }
            }
            else if (!AlertMessage.Equals(alertToComplete.AlertMessage))
            {
                return(false);
            }

            if (!Risk.Equals(alertToComplete.Risk))
            {
                return(false);
            }

            if (!Confidence.Equals(alertToComplete.Confidence))
            {
                return(false);
            }

            if (Url == null)
            {
                if (alertToComplete.Url != null)
                {
                    return(false);
                }
            }
            else if (!Url.Equals(alertToComplete.Url))
            {
                return(false);
            }

            if (Other == null)
            {
                if (alertToComplete.Other != null)
                {
                    return(false);
                }
            }
            else if (!Other.Equals(alertToComplete.Other))
            {
                return(false);
            }

            if (Parameter == null)
            {
                if (alertToComplete.Parameter != null)
                {
                    return(false);
                }
            }
            else if (!Parameter.Equals(alertToComplete.Parameter))
            {
                return(false);
            }

            if (Attack == null)
            {
                if (alertToComplete.Attack != null)
                {
                    return(false);
                }
            }
            else if (!Attack.Equals(alertToComplete.Attack))
            {
                return(false);
            }

            if (Evidence == null)
            {
                if (alertToComplete.Evidence != null)
                {
                    return(false);
                }
            }
            else if (!Evidence.Equals(alertToComplete.Evidence))
            {
                return(false);
            }

            if (Description == null)
            {
                if (alertToComplete.Description != null)
                {
                    return(false);
                }
            }
            else if (!Description.Equals(alertToComplete.Description))
            {
                return(false);
            }

            if (Reference == null)
            {
                if (alertToComplete.Reference != null)
                {
                    return(false);
                }
            }
            else if (!Reference.Equals(alertToComplete.Reference))
            {
                return(false);
            }

            if (Solution == null)
            {
                if (alertToComplete.Solution != null)
                {
                    return(false);
                }
            }
            else if (!Solution.Equals(alertToComplete.Solution))
            {
                return(false);
            }

            if (CweId != alertToComplete.CweId)
            {
                return(false);
            }

            if (WascId != alertToComplete.WascId)
            {
                return(false);
            }

            return(true);
        }
Пример #11
0
        protected void btnUploadFile_Click(object sender, EventArgs e)
        {
            string tempFileName = Path.GetFileName(fulFile.PostedFile.FileName);


            bool invalid = validateFileType(tempFileName);


            if (ddlTypeAttachment.SelectedIndex != 0)
            {
                if (tempFileName != string.Empty)
                {
                    FileInfo f           = new FileInfo(tempFileName);
                    string   surNameFile = f.Extension;

                    string fileName = string.Empty;

                    var TypeFile = AttachFiles.Where(w => w.ATTACH_FILE_TYPE == ddlTypeAttachment.SelectedValue).FirstOrDefault();


                    string        yearMonthDay = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                    string        hourMinSec   = DateTime.Now.ToString("HHmmss", System.Globalization.CultureInfo.InvariantCulture);
                    DirectoryInfo DirInfo      = new DirectoryInfo(Server.MapPath(mapPath) + this.TempFolderOracle);

                    if (invalid)
                    {
                        if (txtIDNumber.Text != string.Empty)
                        {
                            var attFileImage = this.GetDocumentTypeIsImage.Where(w => w.Id == ddlTypeAttachment.SelectedValue).FirstOrDefault();

                            if (attFileImage != null)
                            {
                                if (TypeFile == null)
                                {
                                    tempFileName = "_" + txtIDNumber.Text + surNameFile;

                                    UploadFileImage(tempFileName);

                                    string[] _fileName = tempFileName.Split('_');

                                    string masterFileName = _fileName[1];

                                    //*** Create Folder ***//
                                    if (!DirInfo.Exists)
                                    {
                                        DirInfo.Create();

                                        fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName));

                                        ddlTypeAttachment.SelectedIndex = 0;
                                        txtDetail.Text = string.Empty;
                                    }
                                    else
                                    {
                                        fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName));

                                        ddlTypeAttachment.SelectedIndex = 0;
                                        txtDetail.Text = string.Empty;
                                    }
                                }
                                else
                                {
                                    AlertMessage.ShowAlertMessage(SysMessage.DeleteFile, SysMessage.PleaseDeleteFile);

                                    ddlTypeAttachment.SelectedIndex = 0;
                                    txtDetail.Text = string.Empty;
                                }
                            }
                            else
                            {
                                if (TypeFile == null)
                                {
                                    tempFileName = "_" + txtIDNumber.Text + "_" + ddlTypeAttachment.SelectedValue + surNameFile;

                                    UploadFile(tempFileName);

                                    string[] _fileName = tempFileName.Split('_');

                                    string masterFileName = _fileName[1] + "_" + _fileName[2];

                                    //*** Create Folder ***//
                                    if (!DirInfo.Exists)
                                    {
                                        DirInfo.Create();

                                        fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName));

                                        ddlTypeAttachment.SelectedIndex = 0;
                                        txtDetail.Text = string.Empty;
                                    }
                                    else
                                    {
                                        fulFile.PostedFile.SaveAs(Server.MapPath(mapPath + "/" + this.TempFolderOracle + "/" + masterFileName));

                                        ddlTypeAttachment.SelectedIndex = 0;
                                        txtDetail.Text = string.Empty;
                                    }
                                }
                                else
                                {
                                    AlertMessage.ShowAlertMessage(SysMessage.DeleteFile, SysMessage.PleaseDeleteFile);

                                    ddlTypeAttachment.SelectedIndex = 0;
                                    txtDetail.Text = string.Empty;
                                }
                            }
                        }
                        else
                        {
                            AlertMessage.ShowAlertMessage(string.Empty, SysMessage.PleaseInputIDNumber);

                            ddlTypeAttachment.SelectedIndex = 0;
                            txtDetail.Text = string.Empty;
                        }
                    }
                    else
                    {
                        AlertMessage.ShowAlertMessage(SysMessage.SelectFile, SysMessage.PleaseSelectFile);

                        ddlTypeAttachment.SelectedIndex = 0;
                        txtDetail.Text = string.Empty;
                    }
                }
                else
                {
                    AlertMessage.ShowAlertMessage(SysMessage.SelectFile, SysMessage.PleaseChooseFile);

                    ddlTypeAttachment.SelectedIndex = 0;
                    txtDetail.Text = string.Empty;
                }
            }
            else
            {
                AlertMessage.ShowAlertMessage(SysMessage.SelectFile, SysMessage.PleaseSelectFile);

                ddlTypeAttachment.SelectedIndex = 0;
                txtDetail.Text = string.Empty;
            }
        }
Пример #12
0
 protected void btnSubmit4_Click(object sender, EventArgs e)
 {
     DB.ExecuteSQL("Update product set QuantityDiscountID=" + ddDiscountTable.SelectedValue);
     AlertMessage.PushAlertMessage("Quantity Tables set", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
 }
Пример #13
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (chkCodition.Checked)
            {
                btnSubmit.Enabled = true;

                if (!ValidDateInput())
                {
                    return;
                }

                Registration item = new Registration();

                var attachFiles = this.AttachFiles;

                item.ID = this.UserID;

                item.MEMBER_TYPE = this.MememberTypeGuest;

                item.ID_CARD_NO          = txtIDNumber.Text;
                item.PRE_NAME_CODE       = ddlTitle.SelectedValue;
                item.NAMES               = txtFirstName.Text;
                item.LASTNAME            = txtLastName.Text;
                item.ID_CARD_NO          = txtIDNumber.Text;
                item.BIRTH_DATE          = Convert.ToDateTime(txtBirthDay.Text);
                item.SEX                 = rblSex.SelectedValue;
                item.NATIONALITY         = ddlNationality.SelectedValue;
                item.EDUCATION_CODE      = ddlEducation.SelectedValue;
                item.EMAIL               = txtEmail.Text;
                item.LOCAL_TELEPHONE     = txtTel.Text;
                item.TELEPHONE           = txtMobilePhone.Text;
                item.ADDRESS_1           = txtCurrentAddress.Text;
                item.PROVINCE_CODE       = ddlProvinceCurrentAddress.SelectedValue;
                item.AREA_CODE           = ddlDistrictCurrentAddress.SelectedValue;
                item.TUMBON_CODE         = ddlParishCurrentAddress.SelectedValue;
                item.ZIP_CODE            = txtPostcodeCurrentAddress.Text;
                item.LOCAL_ADDRESS1      = txtRegisterAddress.Text;
                item.LOCAL_PROVINCE_CODE = ddlProvinceRegisterAddress.SelectedValue;
                item.LOCAL_AREA_CODE     = ddlDistrictRegisterAddress.SelectedValue;
                item.LOCAL_TUMBON_CODE   = ddlParishRegisterAddress.SelectedValue;
                item.LOCAL_ZIPCODE       = txtPostcodeRegisterAddress.Text;
                item.CREATED_BY          = "123";
                item.CREATED_DATE        = DateTime.Now;
                item.UPDATED_BY          = "123";
                item.UPDATED_DATE        = DateTime.Now;
                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    item.REG_PASSWORD = txtPassword.Text;
                }
                else
                {
                    AlertMessage.ShowAlertMessage(string.Empty, SysMessage.NotSame);
                    return;
                }


                if (item != null)
                {
                    //var res = biz.Insert(item);

                    BLL.RegistrationBiz biz = new BLL.RegistrationBiz();

                    var result = biz.ValidateBeforeSubmit(DTO.RegistrationType.General, item);

                    if (result.IsError)
                    {
                        var errorMsg = result.ErrorMsg;
                        AlertMessage.ShowAlertMessage(string.Empty, errorMsg);
                    }
                    else
                    {
                        if (this.AttachFiles.Count != 0)
                        {
                            foreach (var att in this.AttachFiles)
                            {
                                var      isImage     = att.IsImage;
                                FileInfo f           = new FileInfo(att.ATTACH_FILE_PATH);
                                string   surNameFile = f.Extension;

                                if (isImage)
                                {
                                    var      tempPath    = att.TempFilePath;
                                    string[] arrTempPath = tempPath.Split('/');

                                    var source = Server.MapPath(mapPath + arrTempPath[0] + "/" + arrTempPath[1]);
                                    var target = Server.MapPath(mapPath + txtIDNumber.Text + surNameFile);


                                    System.IO.Directory.Move(source, target);
                                }
                                else
                                {
                                    var      tempPath    = att.TempFilePath;
                                    string[] arrTempPath = tempPath.Split('/');

                                    var source = Server.MapPath(mapPath + arrTempPath[0] + "/" + arrTempPath[1]);
                                    var target = Server.MapPath(mapPath + txtIDNumber.Text + "_" + att.ATTACH_FILE_TYPE + surNameFile);

                                    System.IO.Directory.Move(source, target);
                                }
                            }

                            DirectoryInfo deleteDirectory = new DirectoryInfo(Server.MapPath(mapPath) + this.TempFolderOracle);

                            deleteDirectory.Delete();
                        }

                        var res = biz.InsertWithAttatchFile(DTO.RegistrationType.General, item, attachFiles);

                        //ถ้าเกิด Error อะไรให้มาทำในที่นี่ Tob 12022013
                        if (res.IsError)
                        {
                            //Response.Write(res.ErrorMsg);
                            var errorMsg = res.ErrorMsg;

                            AlertMessage.ShowAlertMessage(string.Empty, errorMsg);
                        }
                        else
                        {
                            Session.Remove("TempFolderOracle");
                            Session.Remove("AttatchFiles");

                            ClearControl();

                            //AlertMessage.ShowAlertMessage(string.Empty, SysMessage.SaveSucess);

                            //string strScript = "<script>" + "alert('ทำการบันทึกข้อมูลเรียบร้อย');";
                            //strScript += "window.location='~/home.aspx';";
                            //strScript += "</script>";
                            //Page.ClientScript.RegisterStartupScript(this.GetType(), "Startup", strScript);

                            ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + Resources.infoSysMessage_RegisSuccess2 + "');window.location.href='home.aspx';", true);
                            //Response.Write("<script>alert('ทำการบันทึกข้อมูลเรียบร้อย');window.location.href='home.aspx';</script>");

                            //Response.Redirect("~/home.aspx");

                            //foreach (var att in attachFiles)
                            //{


                            //    var nameFile = att.ATTACH_FILE_PATH;

                            //    string[] arrNameFile = nameFile.Split('/');

                            //    var source = Server.MapPath(mapPath + arrNameFile[0] + "/" + "_" + arrNameFile[1]);
                            //    var target = Server.MapPath(mapPath + arrNameFile[0] + "/" + arrNameFile[1]);


                            //    System.IO.Directory.Move(source, target);
                            //}
                        }
                    }


                    //ถ้าเกิด Error อะไรให้มาทำในที่นี่ Tob 12022013


                    //Response.Write(detail.ErrorMsg);
                }
                else
                {
                    AlertMessage.ShowAlertMessage(SysMessage.Fail, SysMessage.TryAgain);
                }
            }
            else
            {
                AlertMessage.ShowAlertMessage(string.Empty, SysMessage.CheckCondition);

                btnSubmit.Enabled = false;
            }
        }
Пример #14
0
        private bool ValidDateInput()
        {
            StringBuilder message      = new StringBuilder();
            StringBuilder messageOther = new StringBuilder();
            bool          isFocus      = false;

            if (ddlTitle.SelectedValue.Length < 1 && ddlTitle.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblTitle.Text);
                if (!isFocus)
                {
                    ddlTitle.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtFirstName.Text) && txtFirstName.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblFirstName.Text);
                if (!isFocus)
                {
                    txtFirstName.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtLastName.Text) && txtLastName.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblLastName.Text);
                if (!isFocus)
                {
                    txtLastName.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtIDNumber.Text) && txtIDNumber.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblIDNumber.Text);
                if (!isFocus)
                {
                    txtIDNumber.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtBirthDay.Text) && txtBirthDay.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblBirthDay.Text);
                if (!isFocus)
                {
                    txtBirthDay.Focus();
                    isFocus = true;
                }
            }

            if (ddlEducation.SelectedValue.Length < 1 && ddlEducation.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblEducation.Text);
                if (!isFocus)
                {
                    ddlEducation.Focus();
                    isFocus = true;
                }
            }

            if (ddlNationality.SelectedValue.Length < 1 && ddlNationality.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblNationality.Text);
                if (!isFocus)
                {
                    ddlNationality.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtMobilePhone.Text) && txtMobilePhone.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblMobilePhone.Text);
                if (!isFocus)
                {
                    txtMobilePhone.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtEmail.Text) && txtEmail.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblEmail.Text);
                if (!isFocus)
                {
                    txtEmail.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtTypeMember.Text) && txtTypeMember.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblTypeMember.Text);
                if (!isFocus)
                {
                    txtTypeMember.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtCurrentAddress.Text) && txtCurrentAddress.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblCurrentAddress.Text);
                if (!isFocus)
                {
                    txtCurrentAddress.Focus();
                    isFocus = true;
                }
            }

            if (ddlProvinceCurrentAddress.SelectedValue.Length < 1 && ddlProvinceCurrentAddress.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblProvinceCurrentAddress.Text);
                if (!isFocus)
                {
                    ddlProvinceCurrentAddress.Focus();
                    isFocus = true;
                }
            }

            if (ddlDistrictCurrentAddress.SelectedValue.Length < 1 && ddlDistrictCurrentAddress.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblDistrictCurrentAddress.Text);
                if (!isFocus)
                {
                    ddlDistrictCurrentAddress.Focus();
                    isFocus = true;
                }
            }

            if (ddlParishCurrentAddress.SelectedValue.Length < 1 && ddlParishCurrentAddress.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblParishCurrentAddress.Text);
                if (!isFocus)
                {
                    ddlParishCurrentAddress.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtPostcodeCurrentAddress.Text) && txtPostcodeCurrentAddress.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblPostcodeCurrentAddress.Text);
                if (!isFocus)
                {
                    txtPostcodeCurrentAddress.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtRegisterAddress.Text) && txtRegisterAddress.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblRegisterAddress.Text);
                if (!isFocus)
                {
                    txtRegisterAddress.Focus();
                    isFocus = true;
                }
            }

            if (ddlProvinceRegisterAddress.SelectedValue.Length < 1 && ddlProvinceRegisterAddress.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblProvinceRegisterAddress.Text);
                if (!isFocus)
                {
                    ddlProvinceRegisterAddress.Focus();
                    isFocus = true;
                }
            }

            if (ddlDistrictRegisterAddress.SelectedValue.Length < 1 && ddlDistrictRegisterAddress.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblDistrictRegisterAddress.Text);
                if (!isFocus)
                {
                    ddlDistrictRegisterAddress.Focus();
                    isFocus = true;
                }
            }

            if (ddlParishRegisterAddress.SelectedValue.Length < 1 && ddlParishRegisterAddress.SelectedIndex == 0)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblParishRegisterAddress.Text);
                if (!isFocus)
                {
                    ddlParishRegisterAddress.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtPostcodeRegisterAddress.Text) && txtPostcodeRegisterAddress.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblProvinceRegisterAddress.Text);
                if (!isFocus)
                {
                    txtPostcodeRegisterAddress.Focus();
                    isFocus = true;
                }
            }

            if (!chkCodition.Checked)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
            }

            if (string.IsNullOrEmpty(txtPassword.Text) && txtPassword.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblPassword.Text);
                if (!isFocus)
                {
                    txtPassword.Focus();
                    isFocus = true;
                }
            }

            if (string.IsNullOrEmpty(txtConfirmPassword.Text) && txtConfirmPassword.Text.Length < 1)
            {
                if (message.Length > 0)
                {
                    message.Append(", ");
                }
                message.Append(lblConfirmPassword.Text);
                if (!isFocus)
                {
                    txtPassword.Focus();
                    isFocus = true;
                }
            }

            if (message.Length > 0)
            {
                AlertMessage.ShowAlertMessage(SysMessage.DataEmpty, message.ToString());

                return(false);
            }
            if (messageOther.Length > 0)
            {
                AlertMessage.ShowAlertMessage(string.Empty, messageOther.ToString());
                txtFirstName.Focus();
                return(false);
            }

            IsValidEmail(txtEmail.Text);

            return(true);
        }
Пример #15
0
        /// <summary>
        /// gvDirectReportCA - RowCreated
        /// </summary>
        protected void gvDirectReportCA_RowCreated(object sender, GridViewRowEventArgs e)
        {
            try
            {
                // Process Header
                //if (e.Row.RowType == DataControlRowType.Header)
                //{
                //    // Create a New Record button
                //    Button btnNew = new Button();
                //    btnNew.ID = "btnNew";
                //    btnNew.Text = "Add";
                //    btnNew.Command += new CommandEventHandler(btnNew_Click);
                //    btnNew.CausesValidation = false;
                //    e.Row.Cells[0].Controls.Add(btnNew);
                //}

                // Process DataRow
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    if (e.Row.DataItem != null)
                    {
                        DataRowView drv = (DataRowView)e.Row.DataItem;

                        // Check for all the rows in the grid
                        for (int i = 0; i <= e.Row.RowIndex; i++)
                        {
                            // Check for Edit Button
                            //if (((Button)e.Row.Cells[6].Controls[0]).Text == "Edit")
                            //{
                            // Hide the Edit Button
                            //((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None";

                            if (Session["Status"] != null)
                            {
                                if (Session["Status"].ToString().ToUpper() == "WIP")
                                {
                                    // Change the Text on the Action Button to Pending Manager TM Discussion
                                    ((Button)e.Row.Cells[6].Controls[0]).Text = "Pnd Mgr TM Disc";
                                }

                                if (Session["Status"].ToString().ToUpper() == "PNDTMDISC")
                                {
                                    // Change the Text on the Action Button to Pending TM Ack
                                    ((Button)e.Row.Cells[6].Controls[0]).Text = "Pnd TM Ack";
                                }

                                if (Session["Status"].ToString().ToUpper() == "PNDTMACK")
                                {
                                    // Hide the Button
                                    ((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None";
                                }

                                if (Session["Status"].ToString().ToUpper() == "TMLOA")
                                {
                                    // Hide the Button
                                    ((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None";
                                }
                            }
                            //}
                        }
                    }

                    //// Check for Edit Button
                    //if (((Button)e.Row.Cells[6].Controls[0]).Text == "Edit")
                    //{
                    //    // Hide the Edit Button
                    //    ((Button)e.Row.Cells[6].Controls[0]).Style["display"] = "None";
                    //}
                }
            }

            catch (InternalException err)
            {
                // Display a Messagebox
                AlertMessage.Show(err.UserFriendlyMsg, this.Page);
            }
            catch (Exception err)
            {
                // Error
                string errMsg = string.Format("{0} - gvDirectReportCA Row Created Error - {1}",
                                              GetType().FullName,
                                              err.Message);

                // Log the Error
                AppLogWrapper.LogError(errMsg);

                // Save a User Friendly Error Message in Session Variable
                errMsg = "There was a problem creating a row in the CA grid for Direct report TMs.  If the problem persists, please contact Technical Support.";

                // Display a Messagebox
                AlertMessage.Show(errMsg, this.Page);
            }
        }
Пример #16
0
        /// <summary>
        /// gvDirectReportCA - OnRowDataBound
        /// </summary>
        protected void gvDirectReportCA_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            const string WIPText       = "Work in Progress";
            const string PndTMDiscText = "Pnd Mgr TM Disc";
            const string PndTMAckText  = "Pnd TM Ack";

            //const string CancelText = "Cancel";

            try
            {
                // Process DataRow
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    int    idx        = Convert.ToInt32(e.Row.RowIndex);
                    string statusCode = gvDirectReportCA.DataKeys[idx].Values["Status_Code"].ToString();

                    //Button btnCancel = (Button)e.Row.Cells[6].Controls[0];
                    Button btnCancel = (Button)e.Row.Cells[6].FindControl("cancel");
                    btnCancel.Visible = false;
                    Button btnPndTMDisc = (Button)e.Row.Cells[6].FindControl("pndTMDisc");
                    btnPndTMDisc.Visible = false;
                    Button btnPndTMAck = (Button)e.Row.Cells[6].FindControl("pndTMAck");
                    btnPndTMAck.Visible = false;

                    DataRowView drv = (DataRowView)e.Row.DataItem;

                    if (statusCode.ToString().ToUpper() == "WIP")
                    {
                        btnPndTMDisc.Visible = true;
                    }

                    if (drv.Row.ItemArray[5].ToString() == WIPText)
                    {
                        btnPndTMDisc.Visible = true;
                    }

                    if (drv.Row.ItemArray[5].ToString() == PndTMDiscText)
                    {
                        btnPndTMDisc.Visible = true;
                    }

                    // Check for Pnd TM Discussion Button
                    if (btnPndTMDisc.Text == PndTMDiscText)
                    {
                        btnPndTMDisc.Attributes["onclick"] = "javascript:if (! confirm('Are you sure you want to change the status. '))" +
                                                             "{return false;}";
                        btnPndTMDisc.Visible = false;
                        btnPndTMAck.Visible  = true;
                    }

                    // Check for Pnd TM Ack Button
                    if (btnPndTMAck.Text == PndTMAckText)
                    {
                        // Add a confirmation
                        //btnPndTMAck.Attributes["onclick"] = "javascript:if (! confirm('Are you sure you want to change the status. '))" +
                        //                                  "{return false;}";

                        if (btnPndTMAck.Attributes["onclick"].Equals(true))
                        {
                            btnPndTMAck.Visible = false;
                        }
                    }

                    // Check if row is NOT in Edit mode
                    if (e.Row.RowState != DataControlRowState.Edit &&
                        e.Row.RowState != (DataControlRowState.Edit | DataControlRowState.Alternate))
                    {
                        // Change the Background Color of the row during Hover
                        GridFormatting.GridViewStyle(e);

                        // Set OnClick event to go into Select Mode
                        e.Row.Attributes.Add("onClick", Page.ClientScript.GetPostBackClientHyperlink(gvDirectReportCA, "Select$" + e.Row.RowIndex));
                    }
                }
            }
            catch (InternalException err)
            {
                // Display a Messagebox
                AlertMessage.Show(err.UserFriendlyMsg, this.Page);
            }
            catch (Exception err)
            {
                // Error
                string errMsg = string.Format("{0} - gvDirectReportCA Row Data Bound Error - {1}",
                                              GetType().FullName,
                                              err.Message);

                // Log the Error
                AppLogWrapper.LogError(errMsg);

                // Save a User Friendly Error Message in Session Variable
                errMsg = "There was a problem creating a row in the CA for DirectReport TM grid.  If the problem persists, please contact Technical Support.";

                // Display a Messagebox
                AlertMessage.Show(errMsg, this.Page);
            }
        }
Пример #17
0
 protected void btnSubmit6_Click(object sender, EventArgs e)
 {
     DB.ExecuteSQL("aspdnsf_ResetAllProductVariantDefaults");
     AlertMessage.PushAlertMessage("Default Variants set", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
 }
        public void Insert(int AlertTypeId,string SingleAlertText,string MultipleAlertText,int AlertOrder)
        {
            AlertMessage item = new AlertMessage();

            item.AlertTypeId = AlertTypeId;

            item.SingleAlertText = SingleAlertText;

            item.MultipleAlertText = MultipleAlertText;

            item.AlertOrder = AlertOrder;

            item.Save(UserName);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityID = CommonLogic.QueryStringUSInt("EntityID");
            if (EntityID < 1)
            {
                EntityID = CommonLogic.FormNativeInt("EntityID");
            }

            EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            if (String.IsNullOrEmpty(EntityName))
            {
                EntityName = CommonLogic.FormCanBeDangerousContent("EntityName");
            }

            m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper        = new EntityHelper(m_EntitySpecs, 0);

            if (EntityID == 0 || EntityName.Length == 0)
            {
                ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting);
                return;
            }

            if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase))
            {
                var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);
                products.PageSize          = 0;
                products.PageNum           = 1;
                products.PublishedOnly     = false;
                products.ReturnAllVariants = true;

                using (var dsProducts = products.LoadFromDB())
                {
                    var NumProducts = products.NumProducts;
                    foreach (DataRow row in dsProducts.Tables[0].Rows)
                    {
                        if (DB.RowFieldBool(row, "IsDownload"))
                        {
                            var ThisProductID = DB.RowFieldInt(row, "ProductID");
                            var ThisVariantID = DB.RowFieldInt(row, "VariantID");
                            var sql           = new StringBuilder(1024);
                            sql.Append("update productvariant set ");

                            var DLoc = CommonLogic.FormCanBeDangerousContent("DownloadLocation_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString());
                            if (DLoc.StartsWith("/"))
                            {
                                DLoc = DLoc.Substring(1, DLoc.Length - 1);                                 // remove leading / char!
                            }
                            sql.Append("DownloadLocation=" + DB.SQuote(DLoc));
                            sql.Append(" where VariantID=" + ThisVariantID.ToString());
                            DB.ExecuteSQL(sql.ToString());
                        }
                    }
                }
                AlertMessage.PushAlertMessage("Download Files Saved", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();

            LoadBody(SelectedLocale.Name);
        }
 protected void btnClearAll_Click(object sender, EventArgs e)
 {
     DB.ExecuteSQL("delete from ShippingMethodToStateMap where ShippingMethodID=" + ShippingMethodID.ToString());
     AlertMessage.PushAlertMessage("Items Saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
     RenderDataTable();
 }
        protected void LoadBody(string locale)
        {
            ltBody.Text  = ("<input type=\"hidden\" name=\"EntityName\" value=\"" + EntityName + "\">\n");
            ltBody.Text += ("<input type=\"hidden\" name=\"EntityID\" value=\"" + EntityID + "\">\n");

            var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID);

            products.PageSize          = 0;
            products.PageNum           = 1;
            products.PublishedOnly     = false;
            products.ReturnAllVariants = true;

            var mappingCount = DB.GetSqlN("select count(*) as N from Product" + this.m_EntitySpecs.m_EntityName + " where " + m_EntitySpecs.m_EntityName + "Id = " + this.EntityID.ToString());

            var dsProducts = new DataSet();

            if (mappingCount > 0)
            {
                dsProducts = products.LoadFromDB();
            }

            var NumProducts = products.NumProducts;

            if (NumProducts > 1000)
            {
                MainBody.Visible = false;
                AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }
            else if (NumProducts > 0)
            {
                ltBody.Text += ("<script type=\"text/javascript\">\n");
                ltBody.Text += ("function Form_Validator(theForm)\n");
                ltBody.Text += ("{\n");
                ltBody.Text += ("submitonce(theForm);\n");
                ltBody.Text += ("return (true);\n");
                ltBody.Text += ("}\n");
                ltBody.Text += ("</script>\n");

                ltBody.Text += ("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                ltBody.Text += ("<table class=\"table\">\n");
                ltBody.Text += ("<tr class=\"table-header\">\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantID", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.ProductName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.VariantName", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("<td><b>" + AppLogic.GetString("admin.common.DownloadFile", SkinID, LocaleSetting) + "</b></td>\n");
                ltBody.Text += ("</tr>\n");

                var LastProductID = 0;
                var rowcount      = dsProducts.Tables[0].Rows.Count;

                for (var i = 0; i < rowcount; i++)
                {
                    var row = dsProducts.Tables[0].Rows[i];

                    if (DB.RowFieldBool(row, "IsDownload"))
                    {
                        var ThisProductID = DB.RowFieldInt(row, "ProductID");
                        var ThisVariantID = DB.RowFieldInt(row, "VariantID");

                        if (i % 2 == 0)
                        {
                            ltBody.Text += ("<tr class=\"table-row2\">\n");
                        }
                        else
                        {
                            ltBody.Text += ("<tr class=\"table-alternatingrow2\">\n");
                        }

                        ltBody.Text += ("<td>");
                        ltBody.Text += (ThisProductID.ToString());
                        ltBody.Text += ("</td>");
                        ltBody.Text += ("<td>");
                        ltBody.Text += (ThisVariantID.ToString());
                        ltBody.Text += ("</td>");
                        ltBody.Text += ("<td>");

                        bool showlinks = false;
                        if (showlinks)
                        {
                            ltBody.Text += ("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("product.aspx") + "?productid=" + ThisProductID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                        }

                        ltBody.Text += (DB.RowFieldByLocale(row, "Name", locale));

                        if (showlinks)
                        {
                            ltBody.Text += ("</a>");
                        }

                        ltBody.Text += ("</td>\n");
                        ltBody.Text += ("<td>");

                        if (showlinks)
                        {
                            ltBody.Text += ("<a target=\"entityBody\" href=\"" + AppLogic.AdminLinkUrl("variant.aspx") + "?productid=" + ThisProductID.ToString() + "&variantid=" + ThisVariantID.ToString() + "&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">");
                        }

                        ltBody.Text += (DB.RowFieldByLocale(row, "VariantName", locale));

                        if (showlinks)
                        {
                            ltBody.Text += ("</a>");
                        }

                        ltBody.Text += ("</td>\n");
                        ltBody.Text += ("<td>");
                        ltBody.Text += ("<input maxLength=\"1000\" class=\"singleNormal\" onkeypress=\"javascript:return WebForm_FireDefaultButton(event, 'btnsubmit')\" name=\"DownloadLocation_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString() + "\" value=\"" + DB.RowField(row, "DownloadLocation") + "\">\n");
                        ltBody.Text += ("</td>\n");
                        ltBody.Text += ("</tr>\n");

                        LastProductID = ThisProductID;
                    }
                }

                if (LastProductID == 0)
                {
                    MainBody.Visible = false;
                    AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.NoDownloadProductsFound", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                }

                ltBody.Text += ("</table>\n");
            }
            else
            {
                MainBody.Visible = false;
                AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.NoProductsFound", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }

            dsProducts.Dispose();
            products.Dispose();
        }
Пример #22
0
        void BindShippingCalculationTable(bool addInsertRow)
        {
            //clear the columns to prevent duplicates
            ShippingGrid.Columns.Clear();

            //We're going to assemble the datasource that we need by putting it together manually here.
            using (DataTable gridData = new DataTable())
            {
                //We'll need shipping method shipping charge amounts to work with in building the data source
                using (DataTable methodAmountsData = new DataTable())
                {
                    //Populate shipping methods data
                    using (SqlConnection sqlConnection = new SqlConnection(DB.GetDBConn()))
                    {
                        sqlConnection.Open();

                        string getShippingMethodMapping       = "exec aspdnsf_GetStoreShippingMethodMapping @StoreID = @StoreId, @IsRTShipping = 0, @OnlyMapped = @FilterByStore";
                        var    getShippingMethodMappingParams = new[]
                        {
                            new SqlParameter("@StoreId", SelectedStoreId),
                            new SqlParameter("@FilterByStore", FilterShipping),
                        };

                        using (IDataReader rs = DB.GetRS(getShippingMethodMapping, getShippingMethodMappingParams, sqlConnection))
                            methodAmountsData.Load(rs);
                    }

                    if (methodAmountsData.Rows.Count == 0)
                    {
                        AlertMessage.PushAlertMessage(String.Format("You do not have any shipping methods setup for the selected store. Please <a href=\"{0}\">click here</a> to set them up.", AppLogic.AdminLinkUrl("shippingmethods.aspx")), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                        ShippingRatePanel.Visible = false;
                        return;
                    }

                    using (DataTable shippingRangeData = new DataTable())
                    {
                        using (SqlConnection sqlConnection = new SqlConnection(DB.GetDBConn()))
                        {
                            //populate the shipping range data
                            var sqlShipping = @"SELECT DISTINCT sw.RowGuid, sw.LowValue, sw.HighValue
									FROM ShippingTotalByZone sw WITH (NOLOCK)
									INNER JOIN ShippingMethod sm WITH (NOLOCK) ON sm.ShippingMethodid = sw.ShippingMethodId AND (@FilterByStore = 0 or @StoreId = sw.StoreID)
									WHERE sw.ShippingZoneID = @ZoneId
									ORDER BY LowValue"                                    ;

                            var shippingRangeDataParams = new[]
                            {
                                new SqlParameter("@StoreId", SelectedStoreId),
                                new SqlParameter("@FilterByStore", FilterShipping),
                                new SqlParameter("@ZoneId", SelectedZoneId),
                            };

                            sqlConnection.Open();
                            using (IDataReader rs = DB.GetRS(sqlShipping, shippingRangeDataParams, sqlConnection))
                                shippingRangeData.Load(rs);
                        }

                        //Add the data columns we'll need on our table and add grid columns to match
                        gridData.Columns.Add(new DataColumn("RowGuid", typeof(string)));

                        gridData.Columns.Add(new DataColumn("LowValue", typeof(string)));
                        BoundField boundField = new BoundField();
                        boundField.DataField             = "LowValue";
                        boundField.HeaderText            = "Low";
                        boundField.ControlStyle.CssClass = "text-xs";
                        ShippingGrid.Columns.Add(boundField);

                        gridData.Columns.Add(new DataColumn("HighValue", typeof(string)));
                        boundField                       = new BoundField();
                        boundField.DataField             = "HighValue";
                        boundField.HeaderText            = "High";
                        boundField.ControlStyle.CssClass = "text-xs";
                        ShippingGrid.Columns.Add(boundField);

                        //Add shipping method columns to our grid data
                        foreach (DataRow methodAmountsRow in methodAmountsData.Rows)
                        {
                            var columnName = String.Format("MethodAmount_{0}", DB.RowField(methodAmountsRow, "ShippingMethodID"));
                            gridData.Columns.Add(new DataColumn(columnName, typeof(string)));
                            //add a column to the gridview to hold the data
                            boundField                       = new BoundField();
                            boundField.DataField             = columnName;
                            boundField.HeaderText            = DB.RowFieldByLocale(methodAmountsRow, "Name", LocaleSetting);
                            boundField.ControlStyle.CssClass = "text-xs";
                            ShippingGrid.Columns.Add(boundField);
                        }

                        //now that our columns are setup add rows to our table
                        foreach (DataRow rangeRow in shippingRangeData.Rows)
                        {
                            var newRow = gridData.NewRow();
                            //add the range data
                            newRow["RowGuid"]   = rangeRow["RowGuid"];
                            newRow["LowValue"]  = rangeRow["LowValue"];
                            newRow["HighValue"] = rangeRow["HighValue"];
                            //add shipping method amounts to our grid data
                            foreach (DataRow methodAmountsRow in methodAmountsData.Rows)
                            {
                                var shippingMethodId  = DB.RowFieldInt(methodAmountsRow, "ShippingMethodID");
                                var shippingRangeGuid = DB.RowFieldGUID(rangeRow, "RowGUID");
                                var amount            = Shipping.GetShipByTotalAndZoneCharge(SelectedZoneId, shippingMethodId, shippingRangeGuid);
                                var localizedAmount   = Localization.CurrencyStringForDBWithoutExchangeRate(amount);

                                var colName = String.Format("MethodAmount_{0}", shippingMethodId);
                                newRow[colName] = localizedAmount;
                            }

                            gridData.Rows.Add(newRow);
                        }

                        //if we're inserting, add an empty row to the end of the table
                        if (addInsertRow)
                        {
                            var newRow = gridData.NewRow();
                            //add the range data
                            newRow["RowGuid"]   = 0;
                            newRow["LowValue"]  = 0;
                            newRow["HighValue"] = 0;
                            //add shipping method columns to our insert row
                            foreach (DataRow methodAmountsRow in methodAmountsData.Rows)
                            {
                                var shippingMethodId = DB.RowFieldInt(methodAmountsRow, "ShippingMethodID");
                                var amount           = 0;
                                var localizedAmount  = Localization.CurrencyStringForDBWithoutExchangeRate(amount);

                                var colName = String.Format("MethodAmount_{0}", shippingMethodId);
                                newRow[colName] = localizedAmount;
                            }
                            gridData.Rows.Add(newRow);
                            //if we're inserting than we'll want to make the insert row editable
                            ShippingGrid.EditIndex = gridData.Rows.Count - 1;
                        }


                        //add the delete button column
                        ButtonField deleteField = new ButtonField();
                        deleteField.ButtonType            = ButtonType.Link;
                        deleteField.Text                  = "<i class=\"fa fa-times\"></i> Delete";
                        deleteField.CommandName           = "Delete";
                        deleteField.ControlStyle.CssClass = "delete-link";
                        deleteField.ItemStyle.Width       = 94;
                        ShippingGrid.Columns.Add(deleteField);

                        //add the edit button column
                        CommandField commandField = new CommandField();
                        commandField.ButtonType            = ButtonType.Link;
                        commandField.ShowEditButton        = true;
                        commandField.ShowDeleteButton      = false;
                        commandField.ShowCancelButton      = true;
                        commandField.ControlStyle.CssClass = "edit-link";
                        commandField.EditText        = "<i class=\"fa fa-share\"></i> Edit";
                        commandField.CancelText      = "<i class=\"fa fa-reply\"></i> Cancel";
                        commandField.UpdateText      = "<i class=\"fa fa-floppy-o\"></i> Save";
                        commandField.ItemStyle.Width = 84;
                        ShippingGrid.Columns.Add(commandField);

                        ShippingGrid.DataSource = gridData;
                        ShippingGrid.DataBind();
                    }
                }
            }

            btnInsert.Visible = !addInsertRow;              //Hide the 'add new row' button while editing/inserting to avoid confusion and lost data
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string errors = "";

            if (fuFile.HasFile)
            {
                HttpPostedFile PostedFile = fuFile.PostedFile;
                if (!PostedFile.FileName.EndsWith("xls", StringComparison.InvariantCultureIgnoreCase) && !PostedFile.FileName.EndsWith("xml", StringComparison.InvariantCultureIgnoreCase) && !PostedFile.FileName.EndsWith("csv", StringComparison.InvariantCultureIgnoreCase) && PostedFile.FileName.Trim() != "")
                {
                    errors = String.Format(AppLogic.GetString("admin.importProductPricing.InvalidFileType", SkinID, LocaleSetting), CommonLogic.IIF(PostedFile.ContentLength == 0, AppLogic.GetString("admin.common.FileContentsWereEmpty", SkinID, LocaleSetting), AppLogic.GetString("admin.common.CommaDelimitedFilesPrompt", SkinID, LocaleSetting)));
                }
                else
                {
                    string filename     = System.Guid.NewGuid().ToString();
                    string FullFilePath = CommonLogic.SafeMapPath("~/images") + "\\" + filename + PostedFile.FileName.ToLowerInvariant().Substring(PostedFile.FileName.LastIndexOf('.'));
                    string xml          = String.Empty;

                    PostedFile.SaveAs(FullFilePath);
                    StreamReader sr          = new StreamReader(FullFilePath);
                    string       filecontent = sr.ReadToEnd();
                    sr.Close();

                    if (PostedFile.FileName.EndsWith("csv", StringComparison.InvariantCultureIgnoreCase))
                    {
                        xml = "<productlist>";
                        string[] rows = filecontent.Split(Environment.NewLine.ToCharArray());
                        for (int i = 1; i < rows.Length; i++)
                        {
                            if (rows[i].Length > 0)
                            {
                                xml += "<productvariant>";
                                string   delim = ",";
                                string[] cols  = rows[i].Split(delim.ToCharArray());
                                xml += "<ProductID>" + cols[0] + "</ProductID>";
                                xml += "<VariantID>" + cols[1] + "</VariantID>";
                                xml += "<KitItemID>" + cols[2] + "</KitItemID>";
                                xml += "<Name>" + cols[3] + "</Name>";
                                xml += "<KitGroup>" + cols[4] + "</KitGroup>";
                                xml += "<SKU>" + cols[5] + "</SKU>";
                                xml += "<SKUSuffix>" + cols[7] + "</SKUSuffix>";
                                xml += "<ManufacturerPartNumber>" + cols[6] + "</ManufacturerPartNumber>";
                                xml += "<Cost>" + cols[8] + "</Cost>";
                                xml += "<MSRP>" + cols[9] + "</MSRP>";
                                xml += "<Price>" + cols[10] + "</Price>";
                                xml += "<SalePrice>" + cols[11] + "</SalePrice>";
                                xml += "<Inventory>" + cols[12] + "</Inventory>";
                                xml += "</productvariant>";
                            }
                        }
                        xml += "</productlist>";
                    }
                    else if (PostedFile.FileName.EndsWith("xls", StringComparison.InvariantCultureIgnoreCase))
                    {
                        xml = Import.ConvertPricingFileToXml(FullFilePath);
                        XslCompiledTransform xForm = new XslCompiledTransform();
                        xForm.Load(CommonLogic.SafeMapPath(string.Format("{0}/XmlPackages/ExcelPricingImport.xslt", AppLogic.AdminDir())));
                        Localization     ExtObj = new Localization();
                        XsltArgumentList m_TransformArgumentList = new XsltArgumentList();
                        m_TransformArgumentList.AddExtensionObject("urn:aspdnsf", ExtObj);
                        XmlDocument xdoc = new XmlDocument();
                        xdoc.LoadXml(xml);
                        StringWriter xsw = new StringWriter();
                        xForm.Transform(xdoc, m_TransformArgumentList, xsw);
                        xml = xsw.ToString();
                    }
                    else
                    {
                        xml = filecontent;
                    }
                    File.Delete(FullFilePath);
                    errors = AppLogic.ImportProductList(xml);
                }
            }
            else
            {
                errors = (AppLogic.GetString("admin.importProductPricing.NothingToImport", SkinID, LocaleSetting));
            }

            if (errors.Length == 0)
            {
                AlertMessage.PushAlertMessage(AppLogic.GetString("admin.importProductPricing.ImportOK", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }
            else
            {
                AlertMessage.PushAlertMessage(errors, AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }
        }
Пример #24
0
        private bool SaveForm()
        {
            if (Page.IsValid)
            {
                //giftCardId = 0 means we're creating a new giftcard
                var creatingGiftCard = giftCardId == 0;
                var giftCardType     = Localization.ParseNativeInt(ddType.SelectedValue);
                var customerId       = Localization.ParseNativeInt(hdnCustomerId.Value);

                //validate customer id if creating giftcard
                if (creatingGiftCard && customerId == 0)
                {
                    AlertMessage.PushAlertMessage("admin.editgiftcard.InvalidEmail".StringResource(), AlertMessage.AlertType.Error);
                    return(false);
                }

                //validate email fields if we're creating an EmailGiftCard
                if (giftCardType == (int)GiftCardTypes.EMailGiftCard && creatingGiftCard)
                {
                    if (txtEmailBody.Text.Length == 0 ||
                        txtEmailName.Text.Length == 0 ||
                        txtEmailTo.Text.Length == 0)
                    {
                        AlertMessage.PushAlertMessage("admin.editgiftcard.EnterEmailPreferences".StringResource(), AlertMessage.AlertType.Error);
                        return(false);
                    }

                    //make sure the customer has set up their email properly
                    if (AppLogic.AppConfig("MailMe_Server").Length == 0 ||
                        AppLogic.AppConfig("MailMe_FromAddress") == "*****@*****.**")
                    {
                        //Customer has not configured their MailMe AppConfigs yet
                        AlertMessage.PushAlertMessage("giftcard.email.error.2".StringResource(), AlertMessage.AlertType.Error);
                        return(false);
                    }
                }

                //make sure the date is filled in
                if (txtDate.SelectedDate == null)
                {
                    AlertMessage.PushAlertMessage("admin.common.FillinExpirationDate".StringResource(), AlertMessage.AlertType.Error);
                    return(false);
                }

                //check if valid SN
                var isDuplicateSerialNumberSql = string.Format("select count(GiftCardID) as N from GiftCard with (NOLOCK) where GiftCardID<>{0} and lower(SerialNumber)={1}",
                                                               giftCardId,
                                                               DB.SQuote(txtSerial.Text.ToLowerInvariant().Trim()));
                var isDuplicateSerialNumber = DB.GetSqlN(isDuplicateSerialNumberSql) > 0;

                if (isDuplicateSerialNumber)
                {
                    AlertMessage.PushAlertMessage("admin.editgiftcard.ExistingGiftCard".StringResource(), AlertMessage.AlertType.Error);
                    return(false);
                }

                if (creatingGiftCard)
                {
                    //insert a new card
                    var newGiftCard = GiftCard.CreateGiftCard(customerId,
                                                              txtSerial.Text,
                                                              Localization.ParseNativeInt(txtOrder.Text),
                                                              0,
                                                              0,
                                                              0,
                                                              Localization.ParseNativeDecimal(txtAmount.Text),
                                                              txtDate.SelectedDate.Value,
                                                              Localization.ParseNativeDecimal(txtAmount.Text),
                                                              ddType.SelectedValue,
                                                              CommonLogic.Left(txtEmailName.Text, 100),
                                                              CommonLogic.Left(txtEmailTo.Text, 100),
                                                              txtEmailBody.Text,
                                                              null,
                                                              null,
                                                              null,
                                                              null,
                                                              null,
                                                              null);

                    try
                    {
                        newGiftCard.SendGiftCardEmail();
                    }
                    catch
                    {
                        //reload page, but inform the admin the the email could not be sent
                        AlertMessage.PushAlertMessage("giftcard.email.error.1".StringResource(), AlertMessage.AlertType.Success);
                    }

                    //reload page
                    giftCardId         = newGiftCard.GiftCardID;
                    etsMapper.ObjectID = giftCardId;
                    AlertMessage.PushAlertMessage("admin.editgiftcard.GiftCardAdded".StringResource(), AlertMessage.AlertType.Success);
                }
                else
                {
                    //update existing card
                    DB.ExecuteSQL(
                        @"UPDATE GiftCard SET
							SerialNumber=@serialNumber,
							ExpirationDate=@expirationDate,
							DisabledByAdministrator=@disabledByAdministrator
						WHERE GiftCardID=@giftCardId"                        ,
                        new[]
                    {
                        new SqlParameter("@serialNumber", txtSerial.Text),
                        new SqlParameter("@expirationDate", Localization.ToDBShortDateString(Localization.ParseNativeDateTime(txtDate.SelectedDate.Value.ToString()))),
                        new SqlParameter("@disabledByAdministrator", Localization.ParseNativeInt(rblAction.SelectedValue)),
                        new SqlParameter("@giftCardId", giftCardId)
                    });

                    etsMapper.ObjectID = giftCardId;
                    AlertMessage.PushAlertMessage("admin.editgiftcard.GiftCardUpdated".StringResource(), AlertMessage.AlertType.Success);
                }
                etsMapper.Save();
            }

            return(true);
        }
Пример #25
0
        //获取列表
        public static List <BrandFullInfo> GetBrandInfos(List <ListFilterField> FilterField, List <ListOrderField> OrderField
                                                         , int PageSize, int PageIndex, out long TotalRowCount, out AlertMessage alertMessage)
        {
            TotalRowCount = 0;
            alertMessage  = null;

            //权限检查
            if (!AUTH.PermissionCheck(ModuleInfo, ActionInfos.Where(i => i.Name == "List").FirstOrDefault(), out string Message))
            {
                alertMessage = new AlertMessage {
                    Message = Message, Type = AlertType.warning
                };
                return(null);
            }

            //查询列表
            using (var EF = new EF())
            {
                IEnumerable <BrandFullInfo> DataList = (from brandInfo in EF.BrandInfos
                                                        join logoFileInfo in EF.FileInfos on brandInfo.LogoFileID equals logoFileInfo.ID into temp1
                                                        from logoFileInfo in temp1.DefaultIfEmpty()
                                                        join logoFileExtName in EF.FileExtName on logoFileInfo.ExtNameID equals logoFileExtName.ID into temp2
                                                        from logoFileExtName in temp2.DefaultIfEmpty()
                                                        join brandFileInfo in EF.FileInfos on brandInfo.BannerFileID equals brandFileInfo.ID into temp3
                                                        from brandFileInfo in temp3.DefaultIfEmpty()
                                                        join brandFileExtName in EF.FileExtName on brandFileInfo.ExtNameID equals brandFileExtName.ID into temp4
                                                        from brandFileExtName in temp4.DefaultIfEmpty()
                                                        select new BrandFullInfo
                {
                    ID = brandInfo.ID,
                    Name = brandInfo.Name,
                    Title = brandInfo.Title,
                    Enabled = brandInfo.Enabled,
                    LogoFileID = brandInfo.LogoFileID,
                    LogoFileGUID = logoFileInfo.GUID,
                    LogoFileName = logoFileInfo.Name,
                    LogoFileExtName = logoFileExtName.Name,
                    BrandFileID = brandInfo.BannerFileID,
                    BrandFileGUID = brandFileInfo.GUID,
                    BrandFileName = brandFileInfo.Name,
                    BrandFileExtName = brandFileExtName.Name,
                });

                //筛选
                foreach (var item in FilterField)
                {
                    if (item.Name == "NameAndTitle" && item.Value.Count > 0)
                    {
                        var predicate = PredicateExtensions.False <BrandFullInfo>();    //设置为False,所有and条件都应该放在or之后,如where (type=1 or type=14) and status==0
                        foreach (var t in item.Value)
                        {
                            var KWPart = t.ToLower();
                            switch (item.CmpareMode)
                            {
                            case FilterCmpareMode.Equal:
                                predicate = predicate.Or(p => p.Name.ToLower() == KWPart || p.Title.ToLower() == KWPart);
                                break;

                            case FilterCmpareMode.Like:
                                predicate = predicate.Or(p => p.Name.ToLower().Contains(KWPart) || p.Title.ToLower().Contains(KWPart));
                                break;
                            }
                        }
                        DataList = DataList.Where(predicate.Compile());
                    }
                }

                //排序
                if (OrderField.Count == 0)
                {
                    DataList = DataList.OrderByDescending(i => i.ID);
                }
                else
                {
                    foreach (var item in OrderField)
                    {
                        switch (item.Mode)
                        {
                        case OrderByMode.Asc:
                            DataList = from list in DataList
                                       orderby OrderBy.GetPropertyValue(list, item.Name)
                                       select list;

                            break;

                        case OrderByMode.Desc:
                            DataList = from list in DataList
                                       orderby OrderBy.GetPropertyValue(list, item.Name) descending
                                       select list;

                            break;
                        }
                    }
                }

                //分页
                TotalRowCount = DataList.Count();
                if (TotalRowCount == 0)
                {
                    return(null);
                }
                int PageCount = (int)Math.Ceiling((double)TotalRowCount / PageSize);
                if (PageIndex > PageCount)
                {
                    PageIndex = PageCount;
                }
                return(DataList.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList());
            }
        }
Пример #26
0
        protected string saveFile(string fileExtension, System.Web.UI.WebControls.FileUpload fileUploads)
        {
            string alertMessage = string.Empty;

            string[] docList         = null;
            string   emplId          = string.Empty;
            string   fileName        = string.Empty;
            string   fileType        = string.Empty;
            string   msg             = string.Empty;
            string   templateId      = string.Empty;
            string   searchCriteria  = string.Empty;
            string   uploadDirectory = string.Empty;
            string   uploadFilePath  = string.Empty;

            try
            {
                emplId = Session["EmplId"].ToString();

                if (fileUploads.HasFile)
                {
                    fileName = Path.GetFileName(fileUploads.FileName);
                    fileType = Path.GetExtension(fileName).ToLower();

                    // Check for Supported file types
                    if (fileType == string.Concat(".", fileExtension))
                    {
                        //Build the full file path for the upload directory with file name
                        uploadDirectory = string.Concat(Server.MapPath(Session["UploadDirectory"].ToString()), emplId);
                        uploadFilePath  = string.Concat(uploadDirectory, "\\", fileName);

                        if (!Directory.Exists(uploadDirectory))
                        {
                            Directory.CreateDirectory(uploadDirectory);
                        }
                        else // Only one file type extension should exist in the directory
                        {
                            searchCriteria = string.Concat("*.", fileExtension);

                            docList = Directory.GetFiles(uploadDirectory, searchCriteria);

                            foreach (string uploadedFile in docList)
                            {
                                File.Delete(uploadedFile);
                            }
                        }

                        fileUploads.PostedFile.SaveAs(uploadFilePath);
                        fileUploads.Dispose();

                        FileInfo fi = new FileInfo(uploadFilePath);

                        //File attribute can't be read only, change to normal
                        if (fi.IsReadOnly)
                        {
                            File.SetAttributes(uploadFilePath, FileAttributes.Normal);
                        }

                        fi          = null;
                        fileUploads = null;

                        // Log the Action
                        msg = string.Format("Create Template Screen - Save File: {0} to {1}",
                                            fileName, uploadFilePath);
                        _HRSCLogsDA.Insert(msg);
                    }
                    else
                    {
                        //Display message
                        msg          = string.Concat("Only a ", fileExtension, " file may be Uploaded");
                        alertMessage = "alert('" + msg + "');";
                        ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Information Message", alertMessage, true);
                    }
                }
                else
                {
                    //Display message
                    msg          = string.Concat("A File Upload is required to be selected. Please use the Browse button for selecting the file to be uploaded.");
                    alertMessage = "alert('" + msg + "');";
                    ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Information Message", alertMessage, true);
                }
            }
            catch (InternalException err)
            {
                // Display a Messagebox
                AlertMessage.Show(err.UserFriendlyMsg, this.Page);
            }
            catch (Exception err)
            {
                // Error
                string errMsg = string.Format("{0} - Upload {1} Click Error - {2}",
                                              GetType().FullName,
                                              fileExtension,
                                              err.Message);

                // Log the Error
                AppLogWrapper.LogError(errMsg);

                // Save a User Friendly Error Message in Session Variable
                errMsg = string.Concat("There was a problem uploading the ", fileExtension, " file.  If the problem persists, please contact Technical Support.");

                // Display a Messagebox
                AlertMessage.Show(errMsg, this.Page);
            }
            return(uploadFilePath);
        }
Пример #27
0
        //更新信息
        public static BrandInfo BrandInfoUpload(BrandInfo brandInfo, out AlertMessage alertMessage)
        {
            //权限检查
            if (!AUTH.PermissionCheck(ModuleInfo, ActionInfos.Where(i => i.Name == (brandInfo.ID == 0 ? "Create" : "Modify")).FirstOrDefault(), out string Message))
            {
                alertMessage = new AlertMessage {
                    Message = Message, Type = AlertType.warning
                };
                return(null);
            }

            //表单检查
            if (string.IsNullOrWhiteSpace(brandInfo.Name))
            {
                alertMessage = new AlertMessage {
                    Message = "品牌代码不能为空。", Type = AlertType.warning
                };
                return(null);
            }
            if (string.IsNullOrWhiteSpace(brandInfo.Title))
            {
                alertMessage = new AlertMessage {
                    Message = "品牌名称不能为空。", Type = AlertType.warning
                };
                return(null);
            }

            using (var EF = new EF())
            {
                //修改是否存在?代码、名称唯一?
                BrandInfo brand_exist       = null;
                BrandInfo brand_name_exist  = null;
                BrandInfo brand_title_exist = null;
                if (brandInfo.ID == 0)
                {
                    brand_name_exist  = EF.BrandInfos.Where(i => i.Name == brandInfo.Name).FirstOrDefault();
                    brand_title_exist = EF.BrandInfos.Where(i => i.Title == brandInfo.Title).FirstOrDefault();
                }
                else
                {
                    brand_exist = EF.BrandInfos.Where(i => i.ID == brandInfo.ID).FirstOrDefault();
                    if (brand_exist == null)
                    {
                        alertMessage = new AlertMessage {
                            Message = string.Format("品牌编号[{0}]不存在。", brandInfo.ID), Type = AlertType.warning
                        };
                        return(null);
                    }
                    brand_name_exist  = EF.BrandInfos.Where(i => i.ID != brandInfo.ID && i.Name == brandInfo.Name).FirstOrDefault();
                    brand_title_exist = EF.BrandInfos.Where(i => i.ID != brandInfo.ID && i.Title == brandInfo.Title).FirstOrDefault();
                }
                if (brand_name_exist != null && brand_name_exist.ID > 0)
                {
                    alertMessage = new AlertMessage {
                        Message = string.Format("品牌代码[{0}]已被ID[{1}]使用。", brandInfo.Name, brand_name_exist.ID), Type = AlertType.warning
                    };
                    return(null);
                }
                if (brand_title_exist != null && brand_title_exist.ID > 0)
                {
                    alertMessage = new AlertMessage {
                        Message = string.Format("品牌名称[{0}]已被ID[{1}]使用。", brandInfo.Title, brand_title_exist.ID), Type = AlertType.warning
                    };
                    return(null);
                }

                //数据保存
                if (brandInfo.ID == 0)
                {
                    brand_exist = EF.BrandInfos.Add(new BrandInfo {
                        Enabled = true,
                    });
                }
                brand_exist.Name         = brandInfo.Name;
                brand_exist.Title        = brandInfo.Title;
                brand_exist.LogoFileID   = brandInfo.LogoFileID;
                brand_exist.BannerFileID = brandInfo.BannerFileID;
                EF.SaveChanges();

                //更新完成
                alertMessage = null;
                return(brand_exist);
            }
        }
Пример #28
0
Файл: Spec.cs Проект: qdjx/C5
        //初始化信息
        public static void InitSpecInfo(out AlertMessage alertMessage)
        {
            alertMessage = null;

            //权限检查
            if (!AUTH.PermissionCheck(ModuleInfo, ActionInfos.Where(i => i.Name == "Init").FirstOrDefault(), out string Message))
            {
                alertMessage = new AlertMessage {
                    Message = Message, Type = AlertType.warning
                };
                return;
            }

            using (var EF = new EF())
            {
                //清除数据表
                var delCount = EF.Database.ExecuteSqlCommand("TRUNCATE TABLE SpecInfo; TRUNCATE TABLE SpecValue;");

                //规格
                var specInfos = new List <SpecInfo> {
                    new SpecInfo {
                        IconFont = "flaticon2-gift", Name = "Color", Title = "颜色", Enabled = true
                    },
                    new SpecInfo {
                        IconFont = "flaticon2-gift", Name = "Memory", Title = "内存", Enabled = true
                    },
                    new SpecInfo {
                        IconFont = "flaticon2-gift", Name = "Clothing sizes", Title = "服装尺寸", Enabled = true
                    },
                };
                EF.SpecInfos.AddRange(specInfos);
                EF.SaveChanges();

                //参数
                List <SpecValue> specValues = new List <SpecValue>();
                foreach (var specInfo in specInfos)
                {
                    switch (specInfo.Name)
                    {
                    case "Color":
                        specValues.AddRange(new List <SpecValue> {
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "黑", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "白", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "红", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "橙", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "黄", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "绿", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "青", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "蓝", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "紫", Enabled = true
                            },
                        });
                        break;

                    case "Memory":
                        specValues.AddRange(new List <SpecValue> {
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "32G", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "64G", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "128G", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "256G", Enabled = true
                            },
                        });
                        break;

                    case "Clothing sizes":
                        specValues.AddRange(new List <SpecValue> {
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "M", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "L", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "XL", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "XXL", Enabled = true
                            },
                            new SpecValue {
                                SpecID = specInfo.ID, Value = "XXXL", Enabled = true
                            },
                        });
                        break;
                    }
                }
                EF.SpecValues.AddRange(specValues);
                EF.SaveChanges();
            }
        }
Пример #29
0
        /// <summary>
        /// gvResults - SelectedIndexChanged
        /// </summary>
        protected void gvResults_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                // Process Selected Row
                if (gvResults.SelectedValue != null)
                {
                    string tmEmplId = gvResults.SelectedValue.ToString();

                    //  Log the Action
                    string logMsg = string.Format("Processor Search Screen - Row Selected - EmplId: {0}",
                                                  tmEmplId);

                    _HRSCLogsDA.Insert(logMsg);

                    if (Session["SearchType"] != null)
                    {
                        if (Session["SearchType"].ToString() == "NewTuitionRequest")
                        {
                            // Save Employee Id
                            Session["TMEmplIdU"] = tmEmplId;

                            // Get Team Member's Name
                            Session["TMNameU"] = GetName(tmEmplId);

                            // Set Tuition Request Id to New Request
                            Session["RequestIdU"] = "0";

                            // Get the Team Member's Balances
                            TMAvailableBalanceDA tmAvailableBalanceDA = new TMAvailableBalanceDA();
                            DataTable            dtTMBal = tmAvailableBalanceDA.GetBal(tmEmplId, System.DateTime.Now);

                            foreach (DataRow dr in dtTMBal.Rows)
                            {
                                if (dr["Reimbursement_Type"].ToString() == "Tuition")
                                {
                                    // Need to save the TM Available Balance for use in the Tuition System Eligibility Checks
                                    Session["TuitionAvailBal"] = dr["AvailAmt"];
                                }
                            }

                            // Display the New Tuition Request screen
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/TuitionRequest/NewRequest.aspx');", true);
                        }
                        else if (Session["SearchType"].ToString() == "NewWWRequest")
                        {
                            // Save Employee Id
                            Session["TMEmplIdU"] = tmEmplId;

                            // Get Team Member's Name
                            Session["TMNameU"] = GetName(tmEmplId);

                            // Set Weight Watcher Request Id to New Request
                            Session["RequestIdU"] = "0";

                            // Display the New Weight Watchers Request screen
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/WeightWatcherRequest/WWNewRequest.aspx');", true);
                        }
                        else if (Session["SearchType"].ToString() == "TuitionReassign")
                        {
                            // Get the Tuition Request record
                            TuitionRequestsBO trBO = new TuitionRequestsBO();
                            TuitionRequestDA  trDA = new TuitionRequestDA();

                            trBO = trDA.GetTuitionRequest(Convert.ToInt32(Session["RequestIdU"]));

                            // Reassign the Processor
                            trBO.Processor   = tmEmplId;
                            trBO.Modified_By = Session["EmplId"].ToString();

                            // Update the Tuition Request
                            trDA.UpdateTuitionRequestStatus(trBO);

                            Session.Remove("SearchType");

                            // Display the Processor Tuition Assigned screen
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/Processor/TuitionAssigned.aspx');", true);
                        }
                        else if (Session["SearchType"].ToString() == "WWReassign")
                        {
                            // Get the Weight Watchers Request record
                            WWRequestBO wwrBO = new WWRequestBO();
                            WWRequestDA wwrDA = new WWRequestDA();

                            wwrBO = wwrDA.GetWWRequest(Convert.ToInt32(Session["RequestIdU"]));

                            // Reassign the Processor
                            wwrBO.Processor   = tmEmplId;
                            wwrBO.Modified_By = Session["EmplId"].ToString();

                            // Update the Weight Watchers Request
                            wwrDA.UpdateWWRequestStatus(wwrBO);

                            Session.Remove("SearchType");

                            // Display the Processor Weight Watchers Assigned screen
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/Processor/WWAssigned.aspx');", true);
                        }
                        else if (Session["SearchType"].ToString() == "CSRTuitionRequest")
                        {
                            // Save Employee Id
                            Session["TMEmplId"] = tmEmplId;

                            // Get Team Member's Name
                            Session["TMName"] = GetName(tmEmplId);

                            // Display the New Tuition Request screen
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/TuitionRequest/TransactionHistory.aspx');", true);
                        }
                        else if (Session["SearchType"].ToString() == "CSRWWRequest")
                        {
                            // Save Employee Id
                            Session["TMEmplId"] = tmEmplId;

                            // Get Team Member's Name
                            Session["TMName"] = GetName(tmEmplId);

                            // Display the New Tuition Request screen
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/WeightWatcherRequest/WWTransactionHistory.aspx');", true);
                        }
                        else if (Session["SearchType"].ToString() == "TuitionCompletedRequests")
                        {
                            // Save Employee Id
                            Session["TCREmplId"] = tmEmplId;

                            // Get Team Member's Name
                            Session["TMName"] = GetName(tmEmplId);

                            // Display the Tuition Completed Requests screen
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openScreen('/QualityReview/TuitionCompletedRequests.aspx');", true);
                        }
                        else
                        {
                            // Save Employee Id
                            Session["TMEmplId"] = tmEmplId;

                            // Get Team Member's Name
                            Session["TMName"] = GetName(tmEmplId);

                            Session.Remove("SearchType");

                            // Display the Team Member Profile screen
                            //((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp2('/Processor/TMProfile.aspx', 'TMProfile', 760, 825); window.close();", true);
                            ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp('/Processor/TMProfile.aspx?TMEmplId=" + tmEmplId + "', 'TMProfile', 760, 825); window.close();", true);
                        }
                    }
                    else
                    {
                        // Save Employee Id
                        Session["TMEmplId"] = tmEmplId;

                        // Get Team Member's Name
                        Session["TMName"] = GetName(tmEmplId);

                        Session.Remove("SearchType");

                        // Display the Team Member Profile screen
                        //((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp2('/Processor/TMProfile.aspx', 'TMProfile', 760, 825); window.close();", true);
                        ((GridView)sender).Page.ClientScript.RegisterStartupScript(((GridView)sender).Page.GetType(), "OpenScreen", "openPopUp('/Processor/TMProfile.aspx?TMEmplId=" + tmEmplId + "', 'TMProfile', 760, 825); window.close();", true);
                    }
                }
            }
            catch (InternalException err)
            {
                // Display a Messagebox
                AlertMessage.Show(err.UserFriendlyMsg, this.Page);
            }
            catch (Exception err)
            {
                // Database Error
                string errMsg = string.Format("{0} - gvResults Selected Index Changed Error - {1}",
                                              GetType().FullName,
                                              err.Message);
                // Log the Error
                AppLogWrapper.LogError(errMsg);

                // Display a User Friendly Error Message
                errMsg = "There was a problem selecting a record on the Search screen.  If the problem persists, please contact Technical Support.";

                // Display a Messagebox
                AlertMessage.Show(errMsg, this.Page);
            }
        }
Пример #30
0
        public AlertMessage UpdateAccess(SupervisorUpdateAccessViewModel model)
        {
            AlertMessage alert = new AlertMessage();

            if (!IsAccessible(ModuleCode.Supervisor))
            {
                alert.Text = StaticMessage.ERR_ACCESS_DENIED;
                return(alert);
            }

            if (model == null || model.ListData.Count == 0)
            {
                alert.Text = StaticMessage.ERR_INVALID_INPUT;
                return(alert);
            }

            IRepository <FSS> repoFSS = _unitOfWork.GetRepository <FSS>();

            var orCondition = PredicateBuilder.False <FSS>();

            foreach (var item in model.ListData)
            {
                orCondition = orCondition.Or(x => x.NIK == item.NIK);
            }

            repoFSS.Condition = PredicateBuilder.True <FSS>().And(orCondition);

            List <FSS> listFSS = repoFSS.Find();

            if (listFSS == null)
            {
                alert.Text = StaticMessage.ERR_DATA_NOT_FOUND;
                return(alert);
            }

            SupervisorNIKValUpdateAccess        valAccess     = null;
            List <SupervisorNIKValUpdateAccess> listValAccess = new List <SupervisorNIKValUpdateAccess>();

            try
            {
                _unitOfWork.BeginTransaction();

                foreach (var fss in listFSS)
                {
                    valAccess = model.ListData.FirstOrDefault(x => x.NIK == fss.NIK);

                    if (valAccess != null)
                    {
                        if (valAccess.IsAllowed)
                        {
                            fss.AllowedByNIK  = _userAuth.NIK;
                            fss.UploadValidTo = valAccess.UploadValidTo;
                        }
                        else
                        {
                            fss.AllowedByNIK  = null;
                            fss.UploadValidTo = null;
                        }

                        repoFSS.Update(fss);
                    }

                    listValAccess.Add(new SupervisorNIKValUpdateAccess()
                    {
                        NIK       = fss.NIK,
                        IsAllowed = fss.AllowedByNIK == null ? false : true,
                        FormattedUploadValidTo = fss.UploadValidTo == null ? "" : fss.UploadValidTo.Value.ToString(AppConstant.DefaultFormatDate)
                    });
                }

                _unitOfWork.Commit();

                alert.Status = 1;
                alert.Data   = listValAccess;
            }
            catch (Exception ex)
            {
                _logger.Write("error", DateTime.Now, ex.Message, _userAuth.Fullname, ex);
                alert.Text = StaticMessage.ERR_SAVE_FAILED;
            }
            finally
            {
                _unitOfWork.Dispose();
            }

            return(alert);
        }
        private bool SaveInventoryRows()
        {
            bool saved = true;

            try
            {
                foreach (GridViewRow row in grdInventory.Rows)
                {
                    Literal ltSize               = (Literal)row.FindControl("ltSize");
                    Literal ltColor              = (Literal)row.FindControl("ltColor");
                    TextBox txtInventory         = (TextBox)row.FindControl("txtInventory");
                    TextBox txtGTIN              = (TextBox)row.FindControl("txtGTIN");
                    TextBox txtWarehouseLocation = (TextBox)row.FindControl("txtWarehouseLocation");
                    TextBox txtVendorId          = (TextBox)row.FindControl("txtVendorId");
                    TextBox txtFullVendorSku     = (TextBox)row.FindControl("txtFullVendorSku");
                    TextBox txtWeightDelta       = (TextBox)row.FindControl("txtWeightDelta");

                    int inventory = 0;
                    int.TryParse(txtInventory.Text, out inventory);

                    decimal weightDelta = decimal.Zero;
                    decimal.TryParse(txtWeightDelta.Text, out weightDelta);

                    string size              = AppLogic.CleanSizeColorOption(ltSize.Text);
                    string color             = AppLogic.CleanSizeColorOption(ltColor.Text);
                    string gtin              = txtGTIN.Text;
                    string warehouseLocation = txtWarehouseLocation.Text;
                    string fullSku           = txtFullVendorSku.Text;
                    string vendorId          = txtVendorId.Text;

                    if (DB.GetSqlN("select count(*) as N from Inventory where VariantID= @VariantId and lower([size]) = @Size and lower(color) = @Color", new SqlParameter[] { new SqlParameter("@VariantId", VariantId), new SqlParameter("@Size", size), new SqlParameter("@Color", color) }) == 0)
                    {
                        DB.ExecuteSQL(@"insert into Inventory(InventoryGUID,VariantID,[Size],Color,Quan,WarehouseLocation,VendorFullSKU,VendorID,WeightDelta,GTIN) 
									values(@InventoryGUID,@VariantId,@Size,@Color,@Inventory,@WarehouseLocation,@FullSku,@VendorId,@WeightDelta,@GTIN)"                                    , new SqlParameter[] {
                            new SqlParameter("@InventoryGUID", DB.GetNewGUID()),
                            new SqlParameter("@VariantId", VariantId),
                            new SqlParameter("@Size", size),
                            new SqlParameter("@Color", color),
                            new SqlParameter("@Inventory", inventory),
                            new SqlParameter("@WarehouseLocation", warehouseLocation),
                            new SqlParameter("@FullSku", fullSku),
                            new SqlParameter("@VendorId", vendorId),
                            new SqlParameter("@WeightDelta", weightDelta),
                            new SqlParameter("@GTIN", gtin)
                        });
                    }
                    else
                    {
                        DB.ExecuteSQL(@"update Inventory set 
									Quan = @Inventory,
									WarehouseLocation = @WarehouseLocation,
									VendorFullSKU = @FullSku,
									VendorID = @VendorId,
									WeightDelta = @WeightDelta,
									GTIN=@GTIN
									where VariantID = @VariantId and lower([size]) = @Size and lower(color) = @Color"                                    , new SqlParameter[] {
                            new SqlParameter("@InventoryGUID", DB.GetNewGUID()),
                            new SqlParameter("@VariantId", VariantId),
                            new SqlParameter("@Size", size),
                            new SqlParameter("@Color", color),
                            new SqlParameter("@Inventory", inventory),
                            new SqlParameter("@WarehouseLocation", warehouseLocation),
                            new SqlParameter("@FullSku", fullSku),
                            new SqlParameter("@VendorId", vendorId),
                            new SqlParameter("@WeightDelta", weightDelta),
                            new SqlParameter("@GTIN", gtin)
                        });
                    }
                }
                ProductVariant       variant         = new ProductVariant(VariantId);
                List <InventoryItem> sizeColorCombos = GetSizeColorCombos(variant);
                LoadInventoryGridView(sizeColorCombos);
                AlertMessage.PushAlertMessage("The inventory has been saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }
            catch (Exception ex)
            {
                saved = false;
                AlertMessage.PushAlertMessage(ex.Message, AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }

            return(saved);
        }
Пример #32
0
 public void SetAlertMessageInTempData(AlertMessageTypeEnum type, string message)
 {
     TempData["AlertMessage"] = new AlertMessage {
         Type = type, Message = message
     };
 }
Пример #33
0
 public static void Display(this UCAlert alert, AlertMessage alertMessage)
 {
     UCAlert.AlertType type = AlertMessageTypeToUCAlertType(alertMessage.Type);
     alert.Display(type, alertMessage.Message);
 }
        public void Update(int AlertID,int AlertTypeId,string SingleAlertText,string MultipleAlertText,int AlertOrder)
        {
            AlertMessage item = new AlertMessage();

                item.AlertID = AlertID;

                item.AlertTypeId = AlertTypeId;

                item.SingleAlertText = SingleAlertText;

                item.MultipleAlertText = MultipleAlertText;

                item.AlertOrder = AlertOrder;

            item.MarkOld();
            item.Save(UserName);
        }
Пример #35
0
 public void PrikaziAlert(AlertMessage alertMessage)
 {
     OnAlertEvent(alertMessage);
 }