示例#1
0
        //Departemen
        //Site
        private MsDepartment[] GridDepartment()
        {
            dc = new DCAssetDataContext();
            List <MsDepartment> msdepartment = new List <MsDepartment>();

            try
            {
                var query = dc.MsDepartment_View("", "G");
                foreach (var res in query)
                {
                    MsDepartment department = new MsDepartment();

                    department.Id       = res.Id;
                    department.DeptCode = res.DeptCode;
                    department.DeptName = res.DeptName;

                    msdepartment.Add(department);
                }
            }
            catch
            {
                msdepartment = null;
            }
            return(msdepartment.ToArray());
        }
示例#2
0
        //Departemen
        //Site
        private MsCurrency[] GridCurrency()
        {
            dc = new DCAssetDataContext();
            List <MsCurrency> mscurrency = new List <MsCurrency>();

            try
            {
                var query = dc.MsCurrency_View("", "G");
                foreach (var res in query)
                {
                    MsCurrency currency = new MsCurrency();

                    currency.Id           = res.Id;
                    currency.CurrencyCode = res.CurrencyCode;
                    currency.CurrencyName = res.CurrencyName;

                    mscurrency.Add(currency);
                }
            }
            catch
            {
                mscurrency = null;
            }
            return(mscurrency.ToArray());
        }
示例#3
0
        //Category
        private MsAssetCategory[] GridAssetCategory()
        {
            dc = new DCAssetDataContext();
            List <MsAssetCategory> msassetcategory = new List <MsAssetCategory>();

            try
            {
                var query = dc.MsAssetCategory_View("", "G");
                foreach (var res in query)
                {
                    MsAssetCategory assetcategory = new MsAssetCategory();

                    assetcategory.Id = res.Id;
                    assetcategory.AssetCategoryCode = res.AssetCategoryCode;
                    assetcategory.AssetCategoryName = res.AssetCategoryName;

                    msassetcategory.Add(assetcategory);
                }
            }
            catch
            {
                msassetcategory = null;
            }
            return(msassetcategory.ToArray());
        }
示例#4
0
        //Asset Status
        private MsAssetStatus[] GridAssetStatus()
        {
            dc = new DCAssetDataContext();
            List <MsAssetStatus> msassetstatus = new List <MsAssetStatus>();

            try
            {
                var query = dc.MsAssetStatus_View("", "G");
                foreach (var res in query)
                {
                    MsAssetStatus assetstatus = new MsAssetStatus();

                    assetstatus.Id         = res.Id;
                    assetstatus.Status     = res.Status;
                    assetstatus.NameStatus = res.NamaStatus;

                    msassetstatus.Add(assetstatus);
                }
            }
            catch
            {
                msassetstatus = null;
            }
            return(msassetstatus.ToArray());
        }
示例#5
0
        public ActionResult InsertSite(string SiteCodeId, string SiteNameId, string AddressId, string CityId, string PostalCodeId, string TelephoneId, int ActiveId)
        {
            try
            {
                dc = new DCAssetDataContext();
                try
                {
                    var    query  = dc.MsSite_IUD(SiteCodeId, SiteNameId, AddressId, CityId, PostalCodeId, TelephoneId, ActiveId, UserId, 1);
                    string status = "";
                    foreach (var res in query)
                    {
                        status = res.Status;
                    }

                    if (status.Trim().Substring(0, 4) == "Err ")
                    {
                        return(Json(new { success = false, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = true, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, responseText = ex.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, responseText = ex.Message.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
            }
        }
示例#6
0
        //Asset Status
        private MsAssetModel[] GridAssetModel()
        {
            dc = new DCAssetDataContext();
            List <MsAssetModel> msassetmodel = new List <MsAssetModel>();

            try
            {
                var query = dc.MsAssetModel_View("", "G");
                foreach (var res in query)
                {
                    MsAssetModel assetmodel = new MsAssetModel();

                    assetmodel.Id        = res.Id;
                    assetmodel.ModelCode = res.ModelCode;
                    assetmodel.ModelName = res.ModelName;
                    assetmodel.BrandCode = res.BrandCode;
                    assetmodel.BrandName = res.BrandName;

                    msassetmodel.Add(assetmodel);
                }
            }
            catch
            {
                msassetmodel = null;
            }
            return(msassetmodel.ToArray());
        }
示例#7
0
        public ActionResult UpdateCurrency(string NoID, string EditCurrencyCodeId, string EditCurrencyNameId)
        {
            try
            {
                dc = new DCAssetDataContext();
                try
                {
                    var    query  = dc.MsCurrency_IUD(EditCurrencyCodeId, EditCurrencyNameId, UserId, 2);
                    string status = "";
                    foreach (var res in query)
                    {
                        status = res.Status;
                    }

                    if (status.Trim().Substring(0, 4) == "Err ")
                    {
                        return(Json(new { success = false, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = true, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, responseText = ex.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, responseText = ex.Message.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
            }
        }
示例#8
0
        //Brand
        private MsAssetBrand[] GridAssetBrand()
        {
            dc = new DCAssetDataContext();
            List <MsAssetBrand> msassetbrand = new List <MsAssetBrand>();

            try
            {
                var query = dc.MsAssetBrand_View("", "G");
                foreach (var res in query)
                {
                    MsAssetBrand assetbrand = new MsAssetBrand();

                    assetbrand.Id        = res.Id;
                    assetbrand.BrandCode = res.BrandCode;
                    assetbrand.BrandName = res.BrandName;

                    msassetbrand.Add(assetbrand);
                }
            }
            catch
            {
                msassetbrand = null;
            }
            return(msassetbrand.ToArray());
        }
示例#9
0
        //Type
        private MsAssetType[] GridAssetType()
        {
            dc = new DCAssetDataContext();
            List <MsAssetType> msassettype = new List <MsAssetType>();

            try
            {
                var query = dc.MsAssetType_View("", "G");
                foreach (var res in query)
                {
                    MsAssetType assettype = new MsAssetType();

                    assettype.Id            = res.Id;
                    assettype.AssetTypeCode = res.AssetTypeCode;
                    assettype.AssetTypeName = res.AssetTypeName;

                    msassettype.Add(assettype);
                }
            }
            catch
            {
                msassettype = null;
            }
            return(msassettype.ToArray());
        }
示例#10
0
        // GET: Asset
        private Ms_Asset[] GridAsset()
        {
            dc = new DCAssetDataContext();
            List <Ms_Asset> msasset = new List <Ms_Asset>();

            try
            {
                var query = dc.MsAsset_View("", "G");
                foreach (var res in query)
                {
                    Ms_Asset asset = new Ms_Asset();
                    asset.Photo          = res.AssetPhoto;
                    asset.AssetCode      = res.AssetTagID;
                    asset.AssetName      = res.AssetName;
                    asset.AssetBrandCode = res.AssetBrand;
                    asset.PurchaseDate   = res.PurchaseDate;
                    double price = Convert.ToDouble(res.PurchasePrice);
                    asset.PurchasePrice = res.CurrencyCode + " " + price.ToString("N0");
                    asset.bStatus       = res.NamaStatus;
                    msasset.Add(asset);
                }
            }
            catch
            {
                msasset = null;
            }
            return(msasset.ToArray());
        }
示例#11
0
        public ActionResult InputData(string site, string category, string location, string departement, string assetname, string supplier, string purchaseno,
                                      string brand, string purchasedateid, string model, string price, string serialno, string type, string company, string currency, string floor, string warranty,
                                      string cap, string active)
        {
            string userid = "system";
            //string Photo = GeneratePhoto(path);
            string hasil = string.Empty;

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsAsset_IUD(assetname, brand, model, category, serialno, type, Convert.ToInt32(active), Convert.ToInt32(cap), "", site, location, Convert.ToInt32(floor),
                                           purchaseno, currency, Convert.ToDecimal(price), Convert.ToDateTime(purchasedateid), supplier, company, departement, Convert.ToInt32(warranty), userid, 1);
                foreach (var res in query)
                {
                    if (res.Status == "Err This Data Already Exists")
                    {
                        hasil = "Data Already Exists";
                    }
                    else
                    {
                        string qrcode = GenerateQrCode(res.Status);
                        var    qr     = dc.MsQrCode_IUD(res.Status, qrcode, userid, 1);
                        hasil = res.Status;
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json(new { error = true, responseText = ex.Message.ToString().Trim() }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = true, responseText = hasil }, JsonRequestBehavior.AllowGet));
        }
示例#12
0
        public ActionResult Insertdepartment(string DepartmentCodeId, string DepartmentNameId)
        {
            try
            {
                dc = new DCAssetDataContext();
                try
                {
                    var    query  = dc.MsDepartment_IUD(DepartmentCodeId, DepartmentNameId, UserId, 1);
                    string status = "";
                    foreach (var res in query)
                    {
                        status = res.Status;
                    }

                    if (status.Trim().Substring(0, 4) == "Err ")
                    {
                        return(Json(new { success = false, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = true, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, responseText = ex.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, responseText = ex.Message.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
            }
        }
示例#13
0
        public ActionResult InsertAssetStatus(string AssetStatusCodeId, string AssetStatusNameId)
        {
            try
            {
                dc = new DCAssetDataContext();
                try
                {
                    var    query = dc.MsAssetStatus_IUD(AssetStatusCodeId, AssetStatusNameId, UserId, 1);
                    string Exx   = "";
                    foreach (var res in query)
                    {
                        Exx = res.Exx;
                    }

                    if (Exx.Trim().Substring(0, 4) == "Err ")
                    {
                        return(Json(new { success = false, responseText = Exx.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = true, responseText = Exx.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, responseText = ex.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, responseText = ex.Message.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet));
            }
        }
示例#14
0
        //Site
        private MsSite[] GridSite()
        {
            dc = new DCAssetDataContext();
            List <MsSite> mssite = new List <MsSite>();

            try
            {
                var query = dc.MsSite_View("", "G");
                foreach (var res in query)
                {
                    string Aktif = "";
                    MsSite site  = new MsSite();
                    if (res.bActive.ToString() == "True")
                    {
                        Aktif = "Y";
                    }
                    else
                    {
                        Aktif = "T";
                    }

                    site.Id         = res.Id;
                    site.SiteCode   = res.SiteCode;
                    site.SiteName   = res.SiteName;
                    site.Address    = res.Address;
                    site.City       = res.City;
                    site.PostalCode = res.PostalCode;
                    site.Telephone  = res.Telephone;
                    site.bActive    = res.bActive;
                    site.Aktif      = Aktif;

                    mssite.Add(site);
                }
            }
            catch
            {
                mssite = null;
            }
            return(mssite.ToArray());
        }
示例#15
0
        public MsCompany[] GetCompany()
        {
            List <MsCompany> mCompany = new List <MsCompany>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsCompany_View("", "G");
                foreach (var res in query)
                {
                    MsCompany company = new MsCompany();
                    company.CompanyCode = res.CompanyCode;
                    company.CompanyName = res.CompanyName;
                    mCompany.Add(company);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mCompany.ToArray());
        }
示例#16
0
        public MsAssetModel[] GetAssetModel()
        {
            List <MsAssetModel> mAssetModel = new List <MsAssetModel>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsAssetModel_View("", "G");
                foreach (var res in query)
                {
                    MsAssetModel assetmodel = new MsAssetModel();
                    assetmodel.ModelCode = res.ModelCode;
                    assetmodel.ModelName = res.ModelName;
                    mAssetModel.Add(assetmodel);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mAssetModel.ToArray());
        }
示例#17
0
        public MsAssetBrand[] GetAssetBrand()
        {
            List <MsAssetBrand> mAssetBrand = new List <MsAssetBrand>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsAssetBrand_View("", "G");
                foreach (var res in query)
                {
                    MsAssetBrand assetbrand = new MsAssetBrand();
                    assetbrand.BrancCode = res.BrandCode;
                    assetbrand.BrandName = res.BrandName;
                    mAssetBrand.Add(assetbrand);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mAssetBrand.ToArray());
        }
示例#18
0
        public MsSupplier[] GetSupplier()
        {
            List <MsSupplier> mSupplier = new List <MsSupplier>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsSupplier_View("", "G");
                foreach (var res in query)
                {
                    MsSupplier supplier = new MsSupplier();
                    supplier.SupplierCode = res.SupplierCode;
                    supplier.SupplierName = res.SupplierName;
                    mSupplier.Add(supplier);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mSupplier.ToArray());
        }
示例#19
0
        public MsAssetType[] GetAssetType()
        {
            List <MsAssetType> mAssetType = new List <MsAssetType>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsAssetType_View("", "G");
                foreach (var res in query)
                {
                    MsAssetType assettype = new MsAssetType();
                    assettype.AssetTypeCode = res.AssetTypeCode;
                    assettype.AssetTypeName = res.AssetTypeName;
                    mAssetType.Add(assettype);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mAssetType.ToArray());
        }
示例#20
0
        public MsLocation[] GetLocation()
        {
            List <MsLocation> mLocation = new List <MsLocation>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsLocation_View("", "G");
                foreach (var res in query)
                {
                    MsLocation location = new MsLocation();
                    location.LocationCode = res.LocationCode;
                    location.LocationName = res.LocationName;
                    mLocation.Add(location);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mLocation.ToArray());
        }
示例#21
0
        public MsSite[] GetSite()
        {
            List <MsSite> msite = new List <MsSite>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsSite_View("", "G");
                foreach (var res in query)
                {
                    MsSite site = new MsSite();
                    site.SiteCode = res.SiteCode;
                    site.SiteName = res.SiteName;
                    msite.Add(site);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(msite.ToArray());
        }
示例#22
0
        public MsDepartment[] GetDept()
        {
            List <MsDepartment> mDept = new List <MsDepartment>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsDepartment_View("", "G");
                foreach (var res in query)
                {
                    MsDepartment dept = new MsDepartment();
                    dept.DeptCode = res.DeptCode;
                    dept.DeptName = res.DeptName;
                    mDept.Add(dept);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mDept.ToArray());
        }
示例#23
0
        public MsAssetCategory[] GetCategory()
        {
            List <MsAssetCategory> mCategory = new List <MsAssetCategory>();

            dc = new DCAssetDataContext();
            try
            {
                var query = dc.MsAssetCategory_View("", "G");
                foreach (var res in query)
                {
                    MsAssetCategory category = new MsAssetCategory();
                    category.AssetCategoryCode = res.AssetCategoryCode;
                    category.AssetCategoryName = res.AssetCategoryName;
                    mCategory.Add(category);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(mCategory.ToArray());
        }
示例#24
0
        private MsLocation[] GridLokasi()
        {
            dc = new DCAssetDataContext();
            List <MsLocation> mslocation = new List <MsLocation>();

            try
            {
                var query = dc.MsLocation_View("", "G");
                foreach (var res in query)
                {
                    string     Aktif  = "";
                    MsLocation lokasi = new MsLocation();
                    if (res.bActive.ToString() == "True")
                    {
                        Aktif = "Y";
                    }
                    else
                    {
                        Aktif = "T";
                    }
                    lokasi.Id           = res.Id;
                    lokasi.LocationCode = res.LocationCode;
                    lokasi.LocationName = res.LocationName;
                    lokasi.SiteCode     = res.SiteCode;
                    lokasi.SiteName     = res.SiteName;
                    lokasi.bActive      = res.bActive;
                    lokasi.Aktif        = Aktif;

                    mslocation.Add(lokasi);
                }
            }
            catch
            {
                mslocation = null;
            }
            return(mslocation.ToArray());
        }