Exemplo n.º 1
0
        public ActionResult ViewCase(int flowCaseId)
        {
            ApplicationUser manager    = new ApplicationUser(WFEntities, this.Username);
            PropertiesValue properties = manager.GetProperties(flowCaseId);
            FlowInfo        info       = manager.GetFlowAndCase(flowCaseId);

            manager.SetCaseAsViewed(flowCaseId, this.Username);
            manager.UpdateLastChecked(flowCaseId, this.Username);
            WF_FlowTypes flowType = manager.GetFlowTypeById(info.FlowTypeId);

            if (flowType.TemplateType.HasValue && flowType.TemplateType.Value == 7)
            {
                WF_FlowPropertys prop = properties.PropertyInfo.FirstOrDefault(p => p.PropertyName.ToLower().Equals("brand") && p.StatusId < 0);
                if (prop != null)
                {
                    string brand = properties.Values.FirstOrDefault(p => p.PropertyId == prop.FlowPropertyId)?.StringValue;
                    Dictionary <string, string> shopList = WFEntities.BLSShopView
                                                           .Where(s => s.Brand.ToLower().Equals(brand.ToLower()))
                                                           .Select(s => new { s.ShopCode, s.ShopName })
                                                           .ToDictionary(s => s.ShopCode, s => s.ShopName);
                    ViewBag.ShopList = shopList;
                }
            }
            ViewBag.Properties  = properties;
            ViewBag.Attachments = manager.GetAttachments(flowCaseId);
            ViewBag.FlowType    = flowType;
            ViewBag.History     = manager.GetCaseHistory(info.CaseInfo.FlowCaseId, info.CaseInfo.BaseFlowCaseId);
            return(PartialView(info));
        }
Exemplo n.º 2
0
 public FlowCondition(WF_FlowPropertys property, string @operator, string value)
 {
     _property  = property;
     _otherProp = null;
     _operator  = @operator;
     _value     = value;
     _userid    = null;
 }
Exemplo n.º 3
0
 public FlowCondition(string otherProp, string @operator, string value, string userid)
 {
     _property  = null;
     _otherProp = otherProp;
     _operator  = @operator;
     _value     = value;
     _userid    = userid;
 }
Exemplo n.º 4
0
        public static IDictionary <string, object> GetHtmlAttributes(WF_FlowPropertys prop, bool inputSmall = false, bool disabled = false, string style = null)
        {
            var shouldAddValdate = false;
            IDictionary <string, object> attrs = new Dictionary <string, object>();

            attrs.Add("class", "form-control");
            if (inputSmall)
            {
                attrs["class"] = attrs["class"] + " input-sm";
            }
            if (prop != null)
            {
                if (prop.Compulsory)
                {
                    shouldAddValdate = true;
                    attrs.Add("data-val-required", "*");
                }
                if (prop.PropertyType == 2 || prop.PropertyType == 4)
                {
                    shouldAddValdate = true;
                    attrs.Add("data-val-number", "*");
                }
                if (prop.PropertyType == 3)
                {
                    attrs["class"] = attrs["class"] + " datetime";
                }
                if (prop.PropertyType == 5)
                {
                    attrs["class"] = attrs["class"] + " date";
                }
                if (prop.PropertyType == 8)
                {
                    attrs["class"] = attrs["class"] + " time";
                }
                if (shouldAddValdate)
                {
                    attrs.Add("data-val", "true");
                }
            }
            if (disabled)
            {
                attrs.Add("disabled", "disabled");
            }
            if (style != null)
            {
                attrs.Add("style", style);
            }
            return(attrs);
        }
Exemplo n.º 5
0
        public string GetPropertyValue(WF_FlowPropertys prop)
        {
            if (prop == null)
            {
                return(null);
            }
            WF_CasePropertyValues value = _caseValues.Values.FirstOrDefault(p => p.PropertyId == prop.FlowPropertyId);

            return(value?.StringValue
                   ?? value?.IntValue?.ToString()
                   ?? value?.DateTimeValue?.ToString("yyyy-MM-ddTHH:mm")
                   ?? value?.NumericValue?.ToString("#.##")
                   ?? value?.TextValue
                   ?? value?.DateValue?.ToString("yyyy-MM-dd")
                   ?? value?.UserNoValue);
        }
Exemplo n.º 6
0
        public static HtmlString RenderControl(WF_FlowPropertys prop, HtmlHelper helper, int index, string value = "")
        {
            IDictionary <string, object> attrs = GetHtmlAttributes(prop);

            if (!String.IsNullOrWhiteSpace(prop.DataSource))
            {
                if (prop.PropertyType == (int)PropertyTypes.RadioGroup)
                {
                    return(helper.RadioButtonList("Properties[" + index + "].Value",
                                                  XElement.Parse(prop.DataSource)
                                                  .Elements("item")
                                                  .Select(
                                                      p =>
                                                      new RadioButtonListItem
                    {
                        Text = p.Value,
                        Checked = p.Value.EqualsIgnoreCaseAndBlank(value)
                    }), RepeatDirection.Horizontal, attrs));
                }
                return(helper.DropDownList("Properties[" + index + "].Value",
                                           XElement.Parse(prop.DataSource)
                                           .Elements("item")
                                           .Select(
                                               p =>
                                               new SelectListItem
                {
                    Text = p.Value,
                    Value = p.Value,
                    Selected = p.Value.EqualsIgnoreCaseAndBlank(value)
                }), "", attrs));
            }
            if (prop.PropertyType == (int)PropertyTypes.Userno)
            {
                return(helper.DropDownList("Properties[" + index + "].Value",
                                           WebCacheHelper.GetUsernames()
                                           .Select(
                                               p =>
                                               new SelectListItem
                {
                    Text = p.Value,
                    Value = p.Key,
                    Selected = p.Key.EqualsIgnoreCaseAndBlank(value)
                }), "",
                                           attrs));
            }
            if (prop.PropertyType == (int)PropertyTypes.Text)
            {
                return(helper.TextArea("Properties[" + index + "].Value", value, attrs));
            }
            if (prop.PropertyType == (int)PropertyTypes.Country)
            {
                return(helper.DropDownList("Properties[" + index + "].Value",
                                           Consts.Countries.Select(
                                               p => new SelectListItem {
                    Text = p, Value = p, Selected = p.EqualsIgnoreCaseAndBlank(value)
                }), "",
                                           attrs));
            }
            if (prop.PropertyType == (int)PropertyTypes.Role)
            {
                return(helper.DropDownList("Properties[" + index + "].Value",
                                           WebCacheHelper.GetRoles().Select(p => new SelectListItem {
                    Text = p.Value, Value = p.Key, Selected = p.Key.EqualsIgnoreCaseAndBlank(value)
                }), "",
                                           attrs));
            }
            if (prop.PropertyType == (int)PropertyTypes.Department)
            {
                return(helper.DropDownList("Properties[" + index + "].Value",
                                           WebCacheHelper.GetDepartments().Select(p => new SelectListItem {
                    Text = p.Value, Value = p.Key, Selected = p.Key.EqualsIgnoreCaseAndBlank(value)
                }), "",
                                           attrs));
            }
            if (prop.PropertyType == (int)PropertyTypes.DeptType)
            {
                return(helper.DropDownList("Properties[" + index + "].Value",
                                           WebCacheHelper.GetDeptTypes().Select(p => new SelectListItem {
                    Text = p.Value, Value = p.Key, Selected = p.Key.EqualsIgnoreCaseAndBlank(value)
                }), "",
                                           attrs));
            }
            if (prop.PropertyType == (int)PropertyTypes.Brand)
            {
                var country = Codehelper.DefaultCountry ?? "";
                return(helper.DropDownList("Properties[" + index + "].Value",
                                           Consts.BrandsOfContries[country]
                                           .Select
                                           (
                                               b => new SelectListItem
                {
                    Text = Consts.GetBrandFullName(b),
                    Value = b,
                    Selected = b.EqualsIgnoreCaseAndBlank(value)
                }
                                           ), "", attrs));
            }
            {
                return(helper.TextBox("Properties[" + index + "].Value", value, attrs));
            }
        }
Exemplo n.º 7
0
        public string GetValueByName(string propertyName)
        {
            WF_FlowPropertys prop = _caseValues.PropertyInfo.FirstOrDefault(p => p.StatusId < 0 && p.PropertyName.Equals(propertyName));

            return(GetPropertyValue(prop));
        }