コード例 #1
0
ファイル: cColor.cs プロジェクト: leolplex/SoftBottin
        /// <summary>
        /// 11 de Julio de 2016 Daniel Romero
        /// Metodo que permite consultar todos los colores por id
        /// </summary>
        /// <param name="iColorID"></param>
        /// <param name="pocColor"></param>
        /// <param name="sErrMessage"></param>
        /// <returns></returns>
        public bool GetColorsById(int iColorID, out cColor pocColor, out string sErrMessage)
        {
            try
            {
                sErrMessage    = "";
                niWsSoftBottin = new wsSoftBottin.SoftBottin();
                DataSet dsColor = new DataSet();
                pocColor = new cColor();
                if (niWsSoftBottin.GetColorById(iColorID, out dsColor, out sErrMessage))
                {
                    for (int iShoeTypes = 0; iShoeTypes < dsColor.Tables[0].Rows.Count; iShoeTypes++)
                    {
                        pocColor.iId          = Convert.ToInt32(dsColor.Tables[0].Rows[iShoeTypes]["Id"].ToString());
                        pocColor.sDescription = dsColor.Tables[0].Rows[iShoeTypes]["Description"].ToString();
                        pocColor.sRGB         = dsColor.Tables[0].Rows[iShoeTypes]["RGB"].ToString();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                cUtilities.WriteLog(ex.Message, out sErrMessage);
                sErrMessage = ex.Message;
                pocColor    = new cColor();
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="iShoeType"></param>
        /// <param name="pocShoeType"></param>
        /// <param name="sErrMessage"></param>
        /// <returns></returns>
        public bool GetShoesTypesById(int iShoeType, out cShoeType pocShoeType, out string sErrMessage)
        {
            try
            {
                sErrMessage    = "";
                niWsSoftBottin = new wsSoftBottin.SoftBottin();
                DataSet dsShoesTypes = new DataSet();
                pocShoeType = new cShoeType();
                if (niWsSoftBottin.GetShoesTypesById(iShoeType, out dsShoesTypes, out sErrMessage))
                {
                    for (int iShoeTypes = 0; iShoeTypes < dsShoesTypes.Tables[0].Rows.Count; iShoeTypes++)
                    {
                        pocShoeType.iId          = Convert.ToInt32(dsShoesTypes.Tables[0].Rows[iShoeTypes]["Id"].ToString());
                        pocShoeType.sName        = dsShoesTypes.Tables[0].Rows[iShoeTypes]["Name"].ToString();
                        pocShoeType.sDescription = dsShoesTypes.Tables[0].Rows[iShoeTypes]["Description"].ToString();
                        pocShoeType.sRef         = dsShoesTypes.Tables[0].Rows[iShoeTypes]["Ref"].ToString();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                cUtilities.WriteLog(ex.Message, out sErrMessage);
                sErrMessage = ex.Message;
                pocShoeType = new cShoeType();
                return(false);
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sName"></param>
        /// <param name="sDescription"></param>
        /// <param name="sRef"></param>
        /// <param name="iQuantityExisting"></param>
        /// <param name="iQuantitySold"></param>
        /// <param name="iPurchasePrice"></param>
        /// <param name="iSalePrice"></param>
        /// <param name="iShoeType"></param>
        /// <param name="lsColorDetail"></param>
        /// <param name="sErrMessage"></param>
        /// <returns></returns>
        public bool AddShoe(string sName, string sDescription, string sRef,
                            int iQuantityExisting, int iQuantitySold, int iPurchasePrice,
                            int iSalePrice, int iShoeType, List <cShoeDetail> lsColorDetail,
                            List <cShoeImage> lsShoeImage,
                            out int iIdInsert,
                            out int iIdDetailInsert,
                            out string sErrMessage)
        {
            try
            {
                iIdDetailInsert = -1;
                sErrMessage     = "";
                niWsSoftBottin  = new wsSoftBottin.SoftBottin();
                iIdInsert       = 0;
                int iCount = 0;
                if (niWsSoftBottin.AddShoe(sName, sDescription, sRef, iQuantityExisting,
                                           iQuantitySold, iPurchasePrice, iSalePrice, iShoeType,
                                           out iIdInsert, out sErrMessage))
                {
                    for (int iColor = 0; iColor < lsColorDetail.Count; iColor++)
                    {
                        niWsSoftBottin.AddShoeDetail(iIdInsert,
                                                     lsColorDetail[iColor].iIdColor,
                                                     lsColorDetail[iColor].iSize,
                                                     lsColorDetail[iColor].iQuantity,
                                                     lsColorDetail[iColor].iQuantityExisting,
                                                     lsColorDetail[iColor].iQuantitySold,
                                                     out iIdDetailInsert,
                                                     out sErrMessage);
                    }

                    foreach (cShoeImage item in lsShoeImage)
                    {
                        AddImageShoe(item.sFileName, item.sContentType, item.bArrayImage, iIdInsert, (iCount == 0 ? true : false), out sErrMessage);
                        iCount++;
                    }

                    return(true);
                }
                else
                {
                    iIdDetailInsert = -1;
                    return(false);
                }
            }
            catch (Exception ex)
            {
                cUtilities.WriteLog(ex.Message, out sErrMessage);
                sErrMessage     = ex.Message;
                iIdInsert       = -1;
                iIdDetailInsert = -1;
                return(false);
            }
        }
コード例 #4
0
 /// <summary>
 /// Daniel Romero 4 de Marzo de 2016
 /// Creacion de metodo para Almacenar el correo electronico del usuario
 /// </summary>
 /// <returns></returns>
 public bool AddNewEmailUser(string sEmail, out string sErrMessage)
 {
     try
     {
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         return(niWsSoftBottin.AddEmailNewUser(sEmail, out sErrMessage));
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMsj);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #5
0
 /// <summary>
 ///4  de Julio de 2016 Daniel Romero
 /// Metodo que permite dar de baja un zapato
 /// </summary>
 /// <param name="iShoeId"></param>
 /// <param name="sErrMessage"></param>
 /// <returns></returns>
 public bool ShoeOut(int iShoeId, out string sErrMessage)
 {
     try
     {
         sErrMessage    = "";
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         return(niWsSoftBottin.ProductOut(iShoeId, out sErrMessage));
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMessage);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="objShowType"></param>
 /// <param name="sErrMessage"></param>
 /// <returns></returns>
 public bool AddShoeType(cShoeType objShowType, out string sErrMessage)
 {
     try
     {
         sErrMessage    = "";
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         return(niWsSoftBottin.AddShoeType(objShowType.sName, objShowType.sDescription, objShowType.sRef, out sErrMessage));
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMessage);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="iIdShoeType"></param>
 /// <param name="sErrMessage"></param>
 /// <returns></returns>
 public bool DeleteShoeType(int iIdShoeType, out string sErrMessage)
 {
     try
     {
         sErrMessage    = "";
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         return(niWsSoftBottin.DeleteShoeType(iIdShoeType, out sErrMessage));
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMessage);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #8
0
ファイル: cColor.cs プロジェクト: leolplex/SoftBottin
 /// <summary>
 /// 11 de Julio de 2016 Daniel Romero
 /// Metodo que permite adicion un color
 /// </summary>
 /// <param name="objColor"></param>
 /// <param name="sErrMessage"></param>
 /// <returns></returns>
 public bool AddColor(cColor objColor, out string sErrMessage)
 {
     try
     {
         sErrMessage    = "";
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         return(niWsSoftBottin.AddColor(objColor.sDescription, objColor.sRGB, out sErrMessage));
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMessage);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #9
0
 /// <summary>
 /// Daniel Romero 26 de Junio de 2016
 /// Creacion de metodo para Crear usuario en el sistema
 /// </summary>
 /// <param name="sFirstName"></param>
 /// <param name="sLastName"></param>
 /// <param name="sEmail"></param>
 /// <param name="sPassword"></param>
 /// <param name="sErrMessage"></param>
 /// <returns></returns>
 public bool SignIn(string sFirstName, string sLastName, string sEmail, string sPassword, out string sErrMessage)
 {
     try
     {
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         sErrMessage    = "";
         return(niWsSoftBottin.SignIn(sFirstName, sLastName, sEmail, sPassword, out sErrMessage));
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMsj);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #10
0
 /// <summary>
 /// Daniel Romero 19 de Junio de 2016
 /// Metodo que se crea para obtener una imagen de un zapato
 /// </summary>
 /// <param name="iIdShoe"></param>
 /// <param name="dsShoes"></param>
 /// <param name="sErrMessage"></param>
 /// <returns></returns>
 public bool GetShoeImages(int iIdShoe, out DataSet dsShoes, out string sErrMessage)
 {
     try
     {
         sErrMessage    = "";
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         return(niWsSoftBottin.GetShoeImages(iIdShoe, out dsShoes, out sErrMessage));
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMessage);
         sErrMessage = ex.Message;
         dsShoes     = new DataSet();
         return(false);
     }
 }
コード例 #11
0
 /// <summary>
 /// Daniel Romero 30 de Mayo de 2016
 /// Creacion de metodo para Autenticarce en el sistema
 /// </summary>
 /// <param name="sUser"></param>
 /// <param name="sPassword"></param>
 /// <returns></returns>
 public bool LogIn(string sUser, string sPassword, out DataSet dsUser, out string sErrMessage)
 {
     try
     {
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         sErrMessage    = "";
         return(niWsSoftBottin.LogIn(sUser, sPassword, out dsUser, out sErrMessage));
     }
     catch (Exception ex)
     {
         dsUser = new DataSet();
         cUtilities.WriteLog(ex.Message, out sErrMsj);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #12
0
        /// <summary>
        /// 11 de Julio de 2016 Daniel Romero
        /// Metodo que permite consultar los zapatos por tipo de zapato
        /// </summary>
        /// <param name="dsColors"></param>
        /// <param name="sErrMessage"></param>
        /// <returns></returns>
        public bool GetShoesByType(int iIdType, out DataSet dsShoes, out string sErrMessage)
        {
            try
            {
                sErrMessage    = "";
                niWsSoftBottin = new wsSoftBottin.SoftBottin();
                niWsSoftBottin.GetShoesByType(iIdType, out dsShoes, out sErrMessage);

                DataTable  workTable = dsShoes.Tables[0];
                DataColumn workCol   = workTable.Columns.Add("Imagebase64", typeof(string));

                for (int iShoes = 0; iShoes < dsShoes.Tables[0].Rows.Count; iShoes++)
                {
                    if (!string.IsNullOrEmpty(dsShoes.Tables[0].Rows[iShoes]["ImageShoe"].ToString()))
                    {
                        byte[] bytes  = (byte[])dsShoes.Tables[0].Rows[iShoes]["ImageShoe"];
                        var    base64 = Convert.ToBase64String(bytes);
                        var    imgSrc = String.Format("data:image/jpg;base64,{0}", base64);
                        dsShoes.Tables[0].Rows[iShoes]["Imagebase64"] = imgSrc;
                    }
                }

                //DataSet dsImges = new DataSet();
                //cShoe nicShoe = new cShoe();
                //nicShoe.GetShoeImages(0, out dsImges, out sErrMessage);


                //byte[] bytes = (byte[])dsImges.Tables[0].Rows[0][5];

                //var base64 = Convert.ToBase64String(bytes);
                //var imgSrc = String.Format("data:image/jpg;base64,{0}", base64);

                //ViewBag.imgSrc = imgSrc;

                return(true);
            }
            catch (Exception ex)
            {
                cUtilities.WriteLog(ex.Message, out sErrMessage);
                sErrMessage = ex.Message;
                dsShoes     = new DataSet();
                return(false);
            }
        }
コード例 #13
0
 /// <summary>
 /// Daniel Romero 19 de Junio de 2016
 /// Metodo que se crea para agregar una imagen de un zapato
 /// </summary>
 /// <param name="iIdShoe"></param>
 /// <param name="sName"></param>
 /// <param name="sType"></param>
 /// <param name="btFileByte"></param>
 /// <param name="sErrMessage"></param>
 /// <returns></returns>
 public bool AddImageShoe(string sName, string sType, byte[] btFileByte, int iProductId, bool bIsPrincipal, out string sErrMessage)
 {
     try
     {
         sErrMessage    = "";
         niWsSoftBottin = new wsSoftBottin.SoftBottin();
         if (niWsSoftBottin.AddImageShoe(sName, sType, btFileByte, iProductId, bIsPrincipal, out sErrMessage))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMessage);
         sErrMessage = ex.Message;
         return(false);
     }
 }
コード例 #14
0
        /// <summary>
        /// Daniel Romero 16 de Julio de 2016
        /// Metodo que se crea para consultar las caracteristicas de un zapato
        /// </summary>
        /// <param name="iShoeId"></param>
        /// <param name="dsShoe"></param>
        /// <param name="sErrMessage"></param>
        /// <returns></returns>
        public bool GetFeaturesByShoe(int iShoeId, out cmProductDetail niProductDetailt, out string sErrMessage)
        {
            try
            {
                DataSet dsShoe = new DataSet();
                niProductDetailt = new cmProductDetail();
                sErrMessage      = "";
                niWsSoftBottin   = new wsSoftBottin.SoftBottin();
                if (niWsSoftBottin.GetFeaturesByShoe(iShoeId, out dsShoe, out sErrMessage))
                {
                    niProductDetailt = new cmProductDetail();
                    List <SelectListItem> lsQuantity = new List <SelectListItem>();
                    int maxQuantity = 5;

                    if (dsShoe.Tables != null)
                    {
                        if (dsShoe.Tables[0].Rows.Count > 0)
                        {
                            maxQuantity = Convert.ToInt32(dsShoe.Tables[0].Rows[0]["ptQuantityExisting"].ToString());
                        }
                    }
                    maxQuantity = maxQuantity > 5 ? 5 : maxQuantity;

                    for (int iQuantity = 0; iQuantity < maxQuantity; iQuantity++)
                    {
                        SelectListItem sliNew = new SelectListItem();
                        sliNew.Text  = (iQuantity + 1).ToString();
                        sliNew.Value = (iQuantity + 1).ToString();
                        lsQuantity.Add(sliNew);
                    }
                    List <SelectListItem> lsSisez = new List <SelectListItem>();
                    DataSet dsSizes = new DataSet();
                    if (niWsSoftBottin.GetSizesByShoe(iShoeId, out dsSizes, out sErrMessage))
                    {
                        for (int iSizes = 0; iSizes < dsSizes.Tables[0].Rows.Count; iSizes++)
                        {
                            SelectListItem sliNew3 = new SelectListItem();
                            sliNew3.Text  = dsSizes.Tables[0].Rows[iSizes]["Size"].ToString();
                            sliNew3.Value = dsSizes.Tables[0].Rows[iSizes]["Size"].ToString();
                            lsSisez.Add(sliNew3);
                        }
                    }

                    niProductDetailt.slQuantity = lsQuantity;
                    niProductDetailt.slSizes    = lsSisez;

                    for (int iShoe = 0; iShoe < dsShoe.Tables[0].Rows.Count; iShoe++)
                    {
                        niProductDetailt.sProductName = dsShoe.Tables[0].Rows[iShoe]["pdName"].ToString();
                        niProductDetailt.sProductId   = dsShoe.Tables[0].Rows[iShoe]["ptIdProduct"].ToString();
                        niProductDetailt.fPrice       = string.IsNullOrEmpty(dsShoe.Tables[0].Rows[iShoe]["pdSalePrice"].ToString())
                                                   ? 0 : Convert.ToSingle(dsShoe.Tables[0].Rows[iShoe]["pdSalePrice"].ToString());
                        niProductDetailt.sDescription = dsShoe.Tables[0].Rows[iShoe]["pdDescription"].ToString();


                        if (!string.IsNullOrEmpty(dsShoe.Tables[0].Rows[iShoe]["imgImage"].ToString()))
                        {
                            byte[] bytes  = (byte[])dsShoe.Tables[0].Rows[iShoe]["imgImage"];
                            var    base64 = Convert.ToBase64String(bytes);
                            var    imgSrc = String.Format("data:image/jpg;base64,{0}", base64);

                            if (iShoe == 0)
                            {
                                niProductDetailt.sPathImageSmall1 = imgSrc;
                                niProductDetailt.sPathImageLarge1 = imgSrc;
                            }
                            if (iShoe == 1)
                            {
                                niProductDetailt.sPathImageSmall2 = imgSrc;
                                niProductDetailt.sPathImageLarge2 = imgSrc;
                            }
                            if (iShoe == 2)
                            {
                                niProductDetailt.sPathImageSmall3 = imgSrc;
                                niProductDetailt.sPathImageLarge3 = imgSrc;
                            }
                        }
                    }
                }
                else
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                niProductDetailt = new cmProductDetail();
                cUtilities.WriteLog(ex.Message, out sErrMsj);
                sErrMessage = ex.Message;
                return(false);
            }
        }