private void CheckNumberFormat(Telephone telephone) { Match longGSM = Regex.Match(telephone.Number, @"[0-9]{10,10}"); if (longGSM.Success) { telephone.Number = telephone.Number.Substring(0, 4) + " " + telephone.Number.Substring(4, 2) + " " + telephone.Number.Substring(6, 2) + " " + telephone.Number.Substring(8, 2); } else { Match longLandline = Regex.Match(telephone.Number, @"[0-9]{9,9}"); if (longLandline.Success) { telephone.Number = telephone.Number.Substring(0, 2) + " " + telephone.Number.Substring(2, 3) + " " + telephone.Number.Substring(5, 2) + " " + telephone.Number.Substring(7, 2); } } }
private void SetCreateAndEditViewbag(Telephone telephone) { ViewBag.TelephoneType = GenericSelectList(db, typeof(Telephone), "TelephoneType", telephone.TelephoneType); ViewBag.Supplier = GenericSelectList(db, typeof(Asset), "Supplier", telephone.Supplier); ViewBag.Owner = GenericSelectList(db, typeof(Asset), "Owner", telephone.Owner); ViewBag.Manufacturer = GenericSelectList(db, typeof(Telephone), "Manufacturer", telephone.Manufacturer); ViewBag.ModelName = GenericSelectList(db, typeof(Telephone), "ModelName", telephone.ModelName); }