示例#1
0
 /// <summary>
 /// Function called to search the model
 /// for availability of the specified string.
 /// </summary>
 /// <param name="str">The search string</param>
 /// <returns>True, if the string is contained in the model, else false</returns>
 public override bool Contains(string str)
 {
     return((ContractNumber != null && ContractNumber.StartsWith(str, StringComparison.CurrentCultureIgnoreCase)) ||
            (CustomerNameAndShortName != null && CustomerNameAndShortName.StartsWith(str, StringComparison.CurrentCultureIgnoreCase)) ||
            (DivisionName != null && DivisionName.StartsWith(str, StringComparison.CurrentCultureIgnoreCase)) ||
            (POReferenceNumber != null && POReferenceNumber.StartsWith(str, StringComparison.CurrentCultureIgnoreCase)) ||
            (EndUser != null && EndUser.StartsWith(str, StringComparison.CurrentCultureIgnoreCase)));
 }
示例#2
0
        /// <summary>
        /// Create new EndUser specified to company and customer
        /// </summary>
        /// <param name="companyId">company Id</param>
        /// <param name="customerId">customer Id</param>
        /// <returns>End User details view</returns>
        public ActionResult EndUserCreate(int companyId, int customerId)
        {
            try
            {
                MODEL.EndUser enduser = new MODEL.EndUser();

                enduser.CompanyId         = companyId;
                enduser.InvoiceCustomerId = customerId;

                return(PartialView("EndUserDetails", enduser));
            }
            catch (Exception e)
            {
                return(new HttpStatusCodeAndErrorResult(500, e.Message));
            }
        }
示例#3
0
 /// <summary>
 /// Save the end user
 /// </summary>
 /// <param name="model">The EndUser model</param>
 public ActionResult EndUserSave(MODEL.EndUser model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             //Get user id
             int?           userId         = Session.GetUserId();
             EndUserService endUserService = new EndUserService();
             EndUserVO      endUserVO      = model.Transpose(userId);
             endUserService.SaveEndUser(endUserVO);
             return(new HttpStatusCodeResult(200));
         }
         else
         {
             throw new ApplicationException(String.Format(Constants.CANNOT_SAVE, Constants.ENDUSER));
         }
     }
     catch (ApplicationException e)
     {
         return(new HttpStatusCodeAndErrorResult(500, e.Message));
     }
 }