Ejemplo n.º 1
0
        public static MCustomer MCustomerEmpty(this BoCustomer oBCustomer)
        {
            var lObject    = LiUtilsLib.bll_GetObjectByName(MGlobalVariables.LNameObjectCustomer);
            var lMCustomer = new MCustomer
            {
                LObject = new MObject
                {
                    LIdObject   = lObject.LIdObject,
                    LNameObject = lObject.LNameObject
                },
                LStatus = new MStatus
                {
                    LDsEstado = null,
                    LIdStatus = null
                },
                LTypeIdentification = new MTypeIdentification
                {
                    LIdTypeIdentification = 0,
                    LTypeIdentification   = null
                },
                LListTypeIdentification = new List <SelectListItem>(),
                LListStatus             = new List <SelectListItem>(),
                LNameCustomer           = null,
                LLastNameCustomer       = null,
                LNoIdentification       = null,
                LIdCustomer             = 0,
                LCreationDate           = new DateTime(),
                LModificationDate       = new DateTime()
            };

            lMCustomer.LListTypeIdentification =
                LiTypeIdentification.bll_getListTypeIdentification().MListAllTypeIdentificationWithSelect(true);
            lMCustomer.LListStatus = LiStatus.Bll_getListStatusByIdObject(lMCustomer.LObject.LIdObject).MListStatusWithSelect();
            return(lMCustomer);
        }
Ejemplo n.º 2
0
        public static MCustomer MCustomerById(this BoCustomer oBCustomer)
        {
            var oMCustomer = new MCustomer
            {
                LObject = new MObject
                {
                    LIdObject   = oBCustomer.LObject.LIdObject,
                    LNameObject = oBCustomer.LObject.LNameObject
                },
                LStatus = new MStatus
                {
                    LDsEstado = oBCustomer.LStatus.LDsEstado,
                    LIdStatus = oBCustomer.LStatus.LIdStatus
                },
                LTypeIdentification =
                    new MTypeIdentification
                {
                    LIdTypeIdentification = oBCustomer.LTypeIdentification.LIdTypeIdentification,
                    LTypeIdentification   = oBCustomer.LTypeIdentification.LTypeIdentification
                },
                LListTypeIdentification = new List <SelectListItem>(),
                LListStatus             = new List <SelectListItem>(),
                LNameCustomer           = oBCustomer.LNameCustomer,
                LLastNameCustomer       = oBCustomer.LLastNameCustomer,
                LNoIdentification       = oBCustomer.LNoIdentification,
                LIdCustomer             = oBCustomer.LIdCustomer,
                LCreationDate           = oBCustomer.LCreationDate,
                LModificationDate       = oBCustomer.LModificationDate
            };

            oMCustomer.LListTypeIdentification =
                LiTypeIdentification.bll_getListTypeIdentification().MListAllTypeIdentification();
            oMCustomer.LListStatus = LiStatus.Bll_getListStatusByIdObject(oBCustomer.LObject.LIdObject).MListAllStatus();
            return(oMCustomer);
        }
        public string bll_DeleteCustomer(int pIdCustomer)
        {
            var oCustomer = new BoCustomer {
                LIdCustomer = pIdCustomer
            };

            return(this.LiCustomer.Dao_DeleteCustomer(oCustomer));
        }
Ejemplo n.º 4
0
        public BoCustomer Dao_getTypeIdentification(int pIdTypeIdentification)
        {
            SqlConnection lConex = new SqlConnection();

            using (lConex = Dao_SqlConnection(lConex))
            {
                var lCustomer = new BoCustomer();
                try
                {
                    var lCommand = new SqlCommand
                    {
                        CommandText    = "spr_GetListAllTypeIdentification",
                        CommandTimeout = 30,
                        CommandType    = CommandType.StoredProcedure,
                        Connection     = lConex
                    };
                    lCommand.Parameters.Add(new SqlParameter("IdCustomer", pIdTypeIdentification));

                    var lReader = lCommand.ExecuteReader();

                    if (lReader.HasRows)
                    {
                        while (lReader.Read())
                        {
                            lCustomer.LTypeIdentification = new BoTypeIdentification();
                            lCustomer.LIdCustomer         = Convert.ToInt32(lReader["IdCustomer"].ToString());
                            lCustomer.LTypeIdentification.LIdTypeIdentification = Convert.ToInt32(lReader["IdTypeIdentification"].ToString());
                            lCustomer.LNoIdentification = lReader["NoIdentification"].ToString();
                            lCustomer.LNameCustomer     = lReader["NameCustomer"].ToString();
                            lCustomer.LLastNameCustomer = lReader["LastNameCustomer"].ToString();
                            lCustomer.LStatus           = new BoStatus {
                                LIdStatus = lReader["IdStatus"].ToString()
                            };
                            lCustomer.LObject = new BoObject
                            {
                                LIdObject = Convert.ToInt32(lReader["IdObject"].ToString())
                            };
                        }
                    }
                    Dao_CloseSqlconnection(lConex);
                    return(lCustomer);
                }
                catch (Exception e)
                {
                    lCustomer = new BoCustomer
                    {
                        LException  = e.Message,
                        LMessageDao = BoErrors.MsgErrorGetSql
                    };
                    if (e.InnerException != null)
                    {
                        lCustomer.LInnerException = e.InnerException.ToString();
                    }
                    Dao_CloseSqlconnection(lConex);
                    return(lCustomer);
                }
            }
        }
        public BoCustomer Dao_getCustomerByDocument(string pNoIdentification, int pIdTypeIdentification)
        {
            SqlConnection lConex = new SqlConnection();

            using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex))
            {
                try
                {
                    var lCommand = new SqlCommand
                    {
                        CommandText    = "spr_GetCustomerByIdentification",
                        CommandTimeout = 30,
                        CommandType    = CommandType.StoredProcedure,
                        Connection     = lConex
                    };
                    lCommand.Parameters.Add(new SqlParameter("@NoIdentification", pNoIdentification));
                    lCommand.Parameters.Add(new SqlParameter("@IdTypeIdentification", pIdTypeIdentification));
                    var lReader   = lCommand.ExecuteReader();
                    var oCustomer = new BoCustomer();
                    if (lReader.HasRows)
                    {
                        while (lReader.Read())
                        {
                            oCustomer.LStatus             = new BoStatus();
                            oCustomer.LObject             = new BoObject();
                            oCustomer.LTypeIdentification = new BoTypeIdentification();
                            oCustomer.LIdCustomer         = Convert.ToInt32(lReader["IdCustomer"].ToString());
                            oCustomer.LTypeIdentification.LIdTypeIdentification = Convert.ToInt32(lReader["IdTypeIdentification"].ToString());
                            oCustomer.LNoIdentification = lReader["NoIdentification"].ToString();
                            oCustomer.LNameCustomer     = lReader["NameCustomer"].ToString();
                            oCustomer.LLastNameCustomer = lReader["LastNameCustomer"].ToString();
                            oCustomer.LCreationDate     = Convert.ToDateTime(lReader["CreationDate"].ToString());
                            oCustomer.LModificationDate = Convert.ToDateTime(lReader["ModificationDate"].ToString());
                            oCustomer.LStatus.LIdStatus = lReader["IdStatus"].ToString();
                            oCustomer.LObject.LIdObject = Convert.ToInt32(lReader["IdObject"].ToString());
                        }
                    }
                    DaoUtilsLib.Dao_CloseSqlconnection(lConex);
                    return(oCustomer);
                }
                catch (Exception e)
                {
                    var oCustomer = new BoCustomer {
                        LException = e.Message
                    };
                    if (e.InnerException != null)
                    {
                        oCustomer.LInnerException = e.InnerException.ToString();
                    }
                    oCustomer.LMessageDao = BoErrors.MsgErrorGetSql;
                    DaoUtilsLib.Dao_CloseSqlconnection(lConex);
                    return(oCustomer);
                }
            }
        }
 public string Dao_UpdateCustomer(BoCustomer pCustomer)
 {
     this.LListParams = new List <SqlParameter>();
     DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.Int, "@IdCustomer", pCustomer.LIdCustomer.ToString());
     DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@NameCustomer", pCustomer.LNameCustomer);
     DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@LastNameCustomer", pCustomer.LLastNameCustomer);
     DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.Int, "@IdTypeIdentification", pCustomer.LTypeIdentification.LIdTypeIdentification.ToString());
     DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@NoIdentification", pCustomer.LNoIdentification);
     DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.VarChar, "@IdStatus", pCustomer.LStatus.LIdStatus);
     return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParams, "LTranUpdateCustomer", "spr_UpdateCustomer"));
 }
        public string bll_InsertCustomer(string pNameCustomer, string pLastNameCustomer, string pNoIdentification, int pIdTypeIdentification, int pIdObject, string pIdStatus)
        {
            var oCustomer = new BoCustomer
            {
                LObject = new BoObject {
                    LIdObject = pIdObject
                },
                LStatus = new BoStatus {
                    LIdStatus = pIdStatus
                },
                LTypeIdentification = new BoTypeIdentification {
                    LIdTypeIdentification = pIdTypeIdentification
                },
                LNameCustomer     = pNameCustomer,
                LLastNameCustomer = pLastNameCustomer,
                LNoIdentification = pNoIdentification
            };

            return(this.LiCustomer.Dao_InsertCustomer(oCustomer));
        }
 public string Dao_DeleteCustomer(BoCustomer pCustomer)
 {
     this.LListParams = new List <SqlParameter>();
     DaoUtilsLib.dao_Addparameters(this.LListParams, SqlDbType.Int, "@IdCustomer", pCustomer.LIdCustomer.ToString());
     return(DaoUtilsLib.Dao_executeSqlTransactionWithProcedement(this.LListParams, "LTranDeleteCustomer", "spr_DeleteCustomer"));
 }
        public List <BoCustomer> Dao_getListAllCustomer()
        {
            SqlConnection lConex = new SqlConnection();

            using (lConex = DaoUtilsLib.Dao_SqlConnection(lConex))
            {
                try
                {
                    var lCommand = new SqlCommand
                    {
                        CommandText    = "spr_GetListAllCustomer",
                        CommandTimeout = 30,
                        CommandType    = CommandType.StoredProcedure,
                        Connection     = lConex
                    };
                    var lReader       = lCommand.ExecuteReader();
                    var oListCustomer = new List <BoCustomer>();
                    if (lReader.HasRows)
                    {
                        while (lReader.Read())
                        {
                            var oCustomer = new BoCustomer
                            {
                                LStatus = new BoStatus
                                {
                                    LIdStatus = lReader["IdStatus"].ToString(),
                                    LDsEstado = lReader["DsEstado"].ToString()
                                },
                                LObject = new BoObject
                                {
                                    LIdObject   = Convert.ToInt32(lReader["IdObject"].ToString()),
                                    LNameObject = lReader["NameObject"].ToString()
                                },
                                LTypeIdentification =
                                    new BoTypeIdentification
                                {
                                    LIdTypeIdentification =
                                        Convert.ToInt32(lReader["IdTypeIdentification"].ToString()),
                                    LTypeIdentification = lReader["TypeIdentification"].ToString()
                                },
                                LIdCustomer       = Convert.ToInt32(lReader["IdCustomer"].ToString()),
                                LNoIdentification = lReader["NoIdentification"].ToString(),
                                LNameCustomer     = lReader["NameCustomer"].ToString(),
                                LLastNameCustomer = lReader["LastNameCustomer"].ToString(),
                                LCreationDate     =
                                    Convert.ToDateTime(lReader["CreationDate"].ToString() == ""
                                        ? new DateTime().ToString(CultureInfo.InvariantCulture)
                                        : lReader["CreationDate"].ToString()),
                                LModificationDate =
                                    Convert.ToDateTime(lReader["ModificationDate"].ToString() == ""
                                        ? new DateTime().ToString(CultureInfo.InvariantCulture)
                                        : lReader["ModificationDate"].ToString())
                            };
                            oListCustomer.Add(oCustomer);
                        }
                    }
                    DaoUtilsLib.Dao_CloseSqlconnection(lConex);
                    return(oListCustomer);
                }
                catch (Exception e)
                {
                    var oListCustomer = new List <BoCustomer>();
                    var oCustomer     = new BoCustomer {
                        LException = e.Message
                    };
                    if (e.InnerException != null)
                    {
                        oCustomer.LInnerException = e.InnerException.ToString();
                    }
                    oCustomer.LMessageDao = BoErrors.MsgErrorGetSql;
                    oListCustomer.Add(oCustomer);
                    DaoUtilsLib.Dao_CloseSqlconnection(lConex);
                    return(oListCustomer);
                }
            }
        }
Ejemplo n.º 10
0
        // GET: Customer/Create
        public ActionResult Create()
        {
            var oBCustomer = new BoCustomer();

            return(this.View(oBCustomer.MCustomerEmpty()));
        }