Ejemplo n.º 1
0
        public Declaration_Info DeclarationGetById(decimal p_id)
        {
            try
            {
                byte[]  byteRecive            = CommonData.c_serviceWCF.DeclarationGetById(p_id);
                DataSet _ds                   = CompressionHelper.DecompressDataSet(byteRecive);
                List <Declaration_Info> _list = NaviCommon.CBO <Declaration_Info> .FillCollectionFromDataSet(_ds);

                Declaration_Info _ObjInfo = new Declaration_Info();
                if (_list.Count > 0)
                {
                    _ObjInfo = _list[0];
                }
                List <Product_Declaration_Info> _listPro = new List <Product_Declaration_Info>();
                if (_ds.Tables.Count > 1)
                {
                    _listPro = NaviCommon.CBO <Product_Declaration_Info> .FillCollectionFromDataTable(_ds.Tables[1]);
                }
                if (_listPro != null)
                {
                    _ObjInfo.ListProduct = _listPro;
                }
                return(_ObjInfo);
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(new Declaration_Info());
            }
        }
Ejemplo n.º 2
0
 public decimal Declaration_Update(Declaration_Info Declaration_Info)
 {
     try
     {
         return(CommonData.c_serviceWCF.Declaration_Update(Declaration_Info.Declaration_Id, Declaration_Info.Declaration_Type,
                                                           Declaration_Info.Register_Date, Declaration_Info.Money_Type, Declaration_Info.Total_Value, Declaration_Info.WareHouse_Id, Declaration_Info.WareHouse_Name, Declaration_Info.WareHouse_Location, Declaration_Info.Gate,
                                                           Declaration_Info.Receive_Number, Declaration_Info.Receive_Year, Declaration_Info.VANDON_NUMBER, Declaration_Info.VANDON_DATE,
                                                           Declaration_Info.Source, Declaration_Info.Custom_Register, Declaration_Info.Modified_By, Declaration_Info.Modified_Date, Declaration_Info.Status));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(-1);
     }
 }
Ejemplo n.º 3
0
 public ActionResult GetProductByDeclaration(decimal p_id)
 {
     try
     {
         Declaration_Info _info  = new Declaration_Info();
         Declaration_BL   _ObjBL = new Declaration_BL();
         _info = _ObjBL.DeclarationGetById(p_id);
         ViewBag.DecrationInfo = _info;
         return(PartialView("/Areas/ModuleDeclaration/Views/YShare/ProductDeclaration.cshtml"));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(null);
     }
 }
Ejemplo n.º 4
0
 public ActionResult ViewApprove(decimal p_id)
 {
     try
     {
         Declaration_Info _info  = new Declaration_Info();
         Declaration_BL   _ObjBL = new Declaration_BL();
         _info = _ObjBL.DeclarationGetById(p_id);
         ViewBag.DecrationInfo = _info;
         ViewBag.IsApprove     = 1;
         return(PartialView("/Areas/ModuleDeclaration/Views/ExportWaiting/ViewDetails.cshtml"));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(null);
     }
 }
Ejemplo n.º 5
0
 public ActionResult Edit()
 {
     try
     {
         string _url = Request.RawUrl;
         string _ok  = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url);
         if (_ok != "")
         {
             return(Redirect(_ok));
         }
         decimal _Id  = 0;
         int     _tab = 1;
         if (RouteData.Values["id"] != null)
         {
             _Id = Convert.ToDecimal(RouteData.Values["id"]);
         }
         if (RouteData.Values["id1"] != null)
         {
             _tab = Convert.ToInt16(RouteData.Values["id1"].ToString());
         }
         Product_BL          _Product_BL = new Product_BL();
         List <Product_Info> _lst_data   = _Product_BL.Product_GetAll();
         ViewBag.ListProduct = _lst_data;
         ViewBag.CurrTab     = _tab;
         Declaration_Info _info  = new Declaration_Info();
         Declaration_BL   _ObjBL = new Declaration_BL();
         _info = _ObjBL.DeclarationGetById(_Id);
         ViewBag.DecrationInfo = _info;
         ViewBag.IsApprove     = 1;
         return(View(_info));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(null);
     }
 }
Ejemplo n.º 6
0
        public ActionResult SaveDeralation(decimal Declaration_Refence_Id, string Declaration_Code,
                                           DateTime Register_Date, decimal Total_Value, string Gate, decimal Receive_Number,
                                           decimal Receive_Year, string Source, string Custom_Register,
                                           decimal Declaration_Type, string STR_LIST_PRODUCTS)
        {
            try
            {
                Declaration_BL   _objBL      = new Declaration_BL();
                Declaration_Info _Importinfo = _objBL.DeclarationGetById(Declaration_Refence_Id);
                Declaration_Info _ObjInfo    = new Declaration_Info();
                _ObjInfo.Declaration_Refence_Id   = Declaration_Refence_Id;
                _ObjInfo.Declaration_Refence_Code = _Importinfo.Declaration_Code;
                _ObjInfo.Declaration_Code         = Declaration_Code;
                _ObjInfo.Contract_Id        = _Importinfo.Contract_Id;
                _ObjInfo.Register_Date      = Register_Date;
                _ObjInfo.Contract_Code      = _Importinfo.Contract_Code;
                _ObjInfo.Total_Value        = Total_Value;
                _ObjInfo.WareHouse_Id       = _Importinfo.WareHouse_Id;
                _ObjInfo.WareHouse_Name     = _Importinfo.WareHouse_Name;
                _ObjInfo.WareHouse_Location = _Importinfo.WareHouse_Location;
                _ObjInfo.Gate             = Gate;
                _ObjInfo.Receive_Number   = Receive_Number;
                _ObjInfo.Receive_Year     = Receive_Year;
                _ObjInfo.Source           = Source; _ObjInfo.Custom_Register = Custom_Register;
                _ObjInfo.Declaration_Type = Declaration_Type;
                _ObjInfo.Status           = (decimal)NaviCommon.Enum_Contract_Status.ChoDuyet;
                _ObjInfo.Type             = (decimal)NaviCommon.Enum_Declaration_Type.ToKhai_Xuat;
                _ObjInfo.Created_Date     = NaviCommon.CommonFuc.CurrentDate();
                _ObjInfo.Created_By       = SessionData.CurrentUser.User_Name;
                STR_LIST_PRODUCTS         = STR_LIST_PRODUCTS.Trim().Trim('|');
                Product_Declaration_Info        _SubInfo     = new Product_Declaration_Info();
                List <Product_Declaration_Info> _ListProduct = new List <Product_Declaration_Info>();
                decimal _rel = 0;

                _rel = _objBL.Declaration_Insert(_ObjInfo);
                if (_rel > 0)
                {
                    string[] _strProduct = STR_LIST_PRODUCTS.Split('|');
                    foreach (var _str in _strProduct)
                    {
                        _SubInfo = new Product_Declaration_Info();
                        string[] _temp = _str.Split(',');
                        if (_temp.Length == 4)
                        {
                            _SubInfo.Declaration_Id           = _rel;
                            _SubInfo.Product_Id               = Convert.ToDecimal(_temp[0]);
                            _SubInfo.Package_Quantity         = Convert.ToDecimal(_temp[1]);
                            _SubInfo.Quantity                 = Convert.ToDecimal(_temp[2]);
                            _SubInfo.Value                    = Convert.ToDecimal(_temp[3]);
                            _SubInfo.Type                     = (decimal)NaviCommon.ProductDeralationType.Export;
                            _SubInfo.Declaration_Reference_Id = Declaration_Refence_Id;
                            _ListProduct.Add(_SubInfo);
                        }
                    }
                }
                Product_Declaration_BL _PrDBL = new Product_Declaration_BL();
                foreach (Product_Declaration_Info item in _ListProduct)
                {
                    if (_PrDBL.Product_Declaration_Insert(item) == false)
                    {
                        _rel = -1;
                        break;
                    }
                }
                return(Json(new { success = _rel }));
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(Json(new { success = -1 }));
            }
        }
Ejemplo n.º 7
0
 public ActionResult SaveDeralation(string Declaration_Code, decimal Contract_Id, string Contract_Code, DateTime Register_Date,
                                    decimal Total_Value, decimal WareHouse_Id, string WareHouse_Name, string Gate, decimal Receive_Number,
                                    decimal Receive_Year, decimal VANDON_NUMBER, DateTime VANDON_DATE, string Source, string Custom_Register,
                                    decimal Declaration_Type, string STR_LIST_PRODUCTS)
 {
     try
     {
         Declaration_Info _ObjInfo = new Declaration_Info();
         _ObjInfo.Declaration_Code = Declaration_Code;
         _ObjInfo.Contract_Id      = Contract_Id; _ObjInfo.Register_Date = Register_Date;
         _ObjInfo.Contract_Code    = Contract_Code.Trim();
         _ObjInfo.Total_Value      = Total_Value;  _ObjInfo.WareHouse_Id = WareHouse_Id;
         _ObjInfo.WareHouse_Name   = WareHouse_Name;  _ObjInfo.Gate = Gate;
         _ObjInfo.Receive_Number   = Receive_Number;
         _ObjInfo.Receive_Year     = Receive_Year; _ObjInfo.VANDON_NUMBER = VANDON_NUMBER;
         _ObjInfo.VANDON_DATE      = VANDON_DATE; _ObjInfo.VANDON_DATE = VANDON_DATE;
         _ObjInfo.Source           = Source; _ObjInfo.Custom_Register = Custom_Register;
         _ObjInfo.Declaration_Type = Declaration_Type;
         _ObjInfo.Status           = (decimal)NaviCommon.Enum_Contract_Status.ChoDuyet;
         _ObjInfo.Type             = (decimal)NaviCommon.Enum_Declaration_Type.ToKhai_Nhap;
         _ObjInfo.Created_Date     = NaviCommon.CommonFuc.CurrentDate();
         _ObjInfo.Created_By       = SessionData.CurrentUser.User_Name;
         STR_LIST_PRODUCTS         = STR_LIST_PRODUCTS.Trim().Trim('|');
         Product_Declaration_Info        _SubInfo     = new Product_Declaration_Info();
         List <Product_Declaration_Info> _ListProduct = new List <Product_Declaration_Info>();
         decimal        _rel   = 0;
         Declaration_BL _objBL = new Declaration_BL();
         _rel = _objBL.Declaration_Insert(_ObjInfo);
         if (_rel > 0)
         {
             string[] _strProduct = STR_LIST_PRODUCTS.Split('|');
             foreach (var _str in _strProduct)
             {
                 _SubInfo = new Product_Declaration_Info();
                 string[] _temp = _str.Split(',');
                 if (_temp.Length == 5)
                 {
                     _SubInfo.Declaration_Id   = _rel;
                     _SubInfo.Product_Id       = Convert.ToDecimal(_temp[0]);
                     _SubInfo.Package_Quantity = Convert.ToDecimal(_temp[1]);
                     _SubInfo.Quantity         = Convert.ToDecimal(_temp[2]);
                     _SubInfo.Made_In          = _temp[3];
                     _SubInfo.Value            = Convert.ToDecimal(_temp[4]);
                     _SubInfo.Type             = (decimal)NaviCommon.ProductDeralationType.Import;
                     // nếu là nhập import thì trường sl còn lại nhâp = luôn số lượng nhập
                     _SubInfo.Package_Quantity_Delivery = _SubInfo.Package_Quantity;
                     _SubInfo.Quantity_Delivery         = _SubInfo.Quantity;
                     _ListProduct.Add(_SubInfo);
                 }
             }
         }
         Product_Declaration_BL _PrDBL = new Product_Declaration_BL();
         foreach (Product_Declaration_Info item in _ListProduct)
         {
             if (_PrDBL.Product_Declaration_Insert(item) == false)
             {
                 _rel = -1;
                 break;
             }
         }
         return(Json(new { success = _rel }));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(Json(new { success = -1 }));
     }
 }