예제 #1
0
        public static Object Customer_Update_Perfil(srCustomer obj)
        {
            Boolean success;

            try
            {
                BaseEntity objEntity  = new BaseEntity();
                Int32      idCustomer = BaseSession.SsOrderxCore.Customer == null ? 0 : BaseSession.SsOrderxCore.Customer.ID;

                Customer objCustomer = new Customer
                {
                    ID               = Convert.ToInt32(idCustomer),
                    FirstName        = obj.FirstName.ToString(),
                    LastNamePaternal = obj.LastNamePaternal.ToString(),
                    LastNameMaternal = obj.LastNameMaternal.ToString(),
                    DocumentType     = Convert.ToInt32(obj.DocumentType),
                    NumberDocument   = obj.NumberDocument.ToString(),
                    CellPhone        = obj.CellPhone.ToString(),
                    Email            = obj.Email.ToString()
                };

                success = CustomerBL.Instance.Customer_Perfil_Update(ref objEntity, objCustomer);
                BaseSession.SsOrderxCore.Customer = objCustomer;
                if (objEntity.Errors.Count == 0)
                {
                    if (success)
                    {
                        return(new { Result = "Ok", Msg = "Se guardo correctamente." });
                    }
                    else
                    {
                        return(new { Result = "NoOk", Msg = "Hubo Un error al guardar." });
                    }
                }
                else
                {
                    return(new { Result = "NoOk", Msg = "A ocurrido un error al guardar." });
                }
            }
            catch (Exception ex)
            {
                return(new { Result = "NoOk", Msg = "A ocurrido un error al guardar" });
            }
        }
예제 #2
0
        public static Object Customer_Update_Address(srCustomer obj)
        {
            Boolean success;

            try
            {
                BaseEntity objEntity  = new BaseEntity();
                Int32      idCustomer = BaseSession.SsOrderxCore.Customer == null ? 0 : BaseSession.SsOrderxCore.Customer.ID;

                Customer objCustomer = new Customer
                {
                    ID = Convert.ToInt32(idCustomer),
                };
                objCustomer.address.Address1 = obj.Address1;

                success = CustomerBL.Instance.Customer_Update_Address(ref objEntity, objCustomer);
                BaseSession.SsOrderxCore.Customer = objCustomer;
                if (objEntity.Errors.Count == 0)
                {
                    if (success)
                    {
                        return(new { Result = "Ok", Msg = "Se actualizó correctamente." });
                    }
                    else
                    {
                        return(new { Result = "NoOk", Msg = "Hubo Un error al guardar." });
                    }
                }
                else
                {
                    return(new { Result = "NoOk", Msg = "A ocurrido un error al guardar" });
                }
            }
            catch (Exception ex)
            {
                return(new { Result = "NoOk", Msg = "A ocurrido un error al guardar" });
            }
        }