Пример #1
0
        public Material LoadDataFromView(string aMatID, string aMatName, string aMatModel, string aMatBrand, string aMatSize, string aMatWeight, string aMatBuyDate,
                        string aMatCost, string aMatInitTime, string aMatInitDist, string aMatRecTime, string aMatRecDist,  
                        string aMatBuyMemo, string aUserID)
        {
            Material aM = new Material();
            bool sigue = true;
            try
            {
                matID = Convert.ToInt64(aMatID);
            }
            catch (Exception)
            {
                sigue = false;
            }

            if (sigue)
            {
                try
                {
                    matWeight = Convert.ToDecimal(aMatWeight);
                }
                catch (Exception)
                {
                    sigue = false;
                }
            }

            if (sigue)
            {
                try
                {
                    matBuyDate = Convert.ToDateTime(aMatBuyDate);
                }
                catch (Exception)
                {
                    sigue = false;
                }
            }

            if (sigue)
            {
                try
                {
                    matCost = Convert.ToDecimal(aMatCost);
                }
                catch (Exception)
                {
                    sigue = false;
                }
            }

            if (sigue)
            {
                try
                {
                    matInitDist = Convert.ToDecimal(aMatInitDist);
                }
                catch (Exception)
                {
                    sigue = false;
                }
            }

            if (sigue)
            {
                try
                {
                    matRecDist = Convert.ToDecimal(aMatRecDist);
                }
                catch (Exception)
                {
                    sigue = false;
                }
            }

            if (sigue)
            {
                try
                {
                    userID = Convert.ToInt64(aUserID);
                }
                catch (Exception)
                {
                    sigue = false;
                }
            }

            if (sigue)
            {
                matName = aMatName;
                matModel = aMatModel;
                matBrand = aMatBrand;
                matSize = aMatSize;
                matInitTime = Time.ConvertStringTimeToLong(aMatInitTime);
                matRecTime = aMatRecTime;
                matBuyMemo = aMatBuyMemo;
            }
            else
                aM.Reset();

            return aM;
        }