Exemplo n.º 1
0
        public HttpResponseMessage GetAllDepartmentList(LocationMasterModel model)
        {
            ResponseStatus response = new ResponseStatus();

            try
            {
                var data = _repository.GetAllDepartmentList(model.DataBaseId);
                if (data.Count() > 0)
                {
                    response.isSuccess          = true;
                    response.serverResponseTime = System.DateTime.Now;
                    return(Request.CreateResponse(HttpStatusCode.OK, new { data, response }));
                }
                else
                {
                    response.isSuccess          = false;
                    response.serverResponseTime = System.DateTime.Now;
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, new { response }));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Something Worng !", ex));
            }
        }
Exemplo n.º 2
0
        public IEnumerable <LocationMasterModel> GetAllLocationList(string databasename)
        {
            string strConnection = "";

            strConnection = "Server=localhost;user id=root;password=pari@123;Database=" + databasename + "";


            List <LocationMasterModel> data   = new List <LocationMasterModel>();
            MySqlConnection            myConn = new MySqlConnection();
            MySqlCommand    myCmd             = new MySqlCommand();
            MySqlDataReader myRdr             = null;

            try
            {
                myConn.ConnectionString = strConnection;
                myConn.Open();
                myCmd.Connection  = myConn;
                myCmd.CommandType = CommandType.Text;
                myCmd.CommandText = "Select COMPANY_NM,Location_id from tblcompany order by COMPANY_NM";
                myRdr             = myCmd.ExecuteReader();

                if (myRdr.HasRows)
                {
                    while (myRdr.Read())
                    {
                        LocationMasterModel singledata = new LocationMasterModel();
                        singledata.LocationId   = myRdr["Location_id"].ToString();
                        singledata.LocationName = myRdr["COMPANY_NM"].ToString();
                        data.Add(singledata);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (myRdr != null)
                {
                    myRdr.Close();
                    myRdr.Dispose();
                    myRdr = null;
                }

                if (myCmd != null)
                {
                    myCmd.Dispose();
                    myCmd = null;
                }
                if (myConn != null)
                {
                    myConn.Close();
                    myConn.Dispose();
                    myConn = null;
                }
            }
            return(data);
        }
Exemplo n.º 3
0
        /// <summary>GetLocationDetailsById
        /// <CreatedBy>Roshan Rahood</CreatedBy>
        /// <CreatedOn>Jan-07-2015</CreatedOn>
        /// <CreatedFor>Get All Location List</CreatedFor>
        /// </summary>
        public LocationMasterModel GetLocationDetailsById(long locationId)
        {
            try
            {
                LocationMasterModel objlocationmaster = objworkorderEMSEntities.LocationMasters.Where(b => b.LocationId == locationId).Select(a => new LocationMasterModel
                {
                    LocationName = a.LocationName,
                    Address1     = a.Address1,
                    Address2     = a.Address2,
                    StateId      = a.StateId,
                    City         = a.City,
                    LocationId   = a.LocationId
                }).SingleOrDefault();

                return(objlocationmaster);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public ActionResult Index()
        {
            long Totalrecords = 0;
            LocationMasterModel objLocationMasterModel = null;

            try
            {
                var data = QRCInIt();
                //ViewBag.EncryptLastQRC = data.EncryptLastQRC;
                eTracLoginModel ObjLogin = (eTracLoginModel)Session["eTrac"];
                objLocationMasterModel       = _ICommonMethod.GetLocationDetailsById(ObjLogin.LocationID);
                ViewBag.EncryptLastQRC       = data.EncryptLastQRC + "," + (string.IsNullOrEmpty(objLocationMasterModel.Address2) ? ObjLogin.Location.ToString().Substring(0, 3).ToUpper() : objLocationMasterModel.Address2.ToString().Substring(0, 3).ToUpper());
                ViewBag.ItemAbberivationList = Convert.ToString(ConfigurationManager.AppSettings["ItemAbberivationList"]);
                ViewBag.PurchType            = _ICommonMethod.GetGlobalCodeDataList("PURCHASETYPE");
                ViewBag.RefreshMode          = false;
                if (ObjLogin != null && (ObjLogin.UserRoleId == Convert.ToInt64(UserType.GlobalAdmin) || ObjLogin.UserRoleId == Convert.ToInt64(UserType.ITAdministrator)))
                {
                    //ViewBag.ManagerList = _IGlobalAdmin.GetAllITAdministratorList(0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Manager), out Totalrecords);
                    ViewBag.LocationList      = _IGlobalAdmin.GetAllLocationNew();
                    ViewBag.AdministratorList = _IGlobalAdmin.GetAllITAdministratorList(0, 0, 1, 1000, "UserEmail", "asc", "", (UserType.Administrator).ToString(), out Totalrecords);
                }
                else if (ObjLogin != null && (ObjLogin.UserRoleId == Convert.ToInt64(UserType.Administrator)))
                {
                    ViewBag.LocationList = _IGlobalAdmin.GetAllLocationNew();
                    // ViewBag.AdministratorList = _IGlobalAdmin.GetAllITAdministratorList(0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Manager), out Totalrecords);

                    ViewBag.AdministratorList = _ICommonMethod.GetManagersBYLocationId(ObjLogin.LocationID);
                }
                //if (!string.IsNullOrEmpty(successCode) && successCode == "Success")
                //{
                //    ModelState.AddModelError("", "Record Saved Sucessfully.");
                //}D:\Project\eTrac\WorkOrderEMS\Views\NewAdmin\QRCView\_QRCForm.cshtml
                return(PartialView("~/Views/NewAdmin/QRCView/_QRCForm.cshtml", data));
                //return View(data);
            }
            catch (Exception ex)
            { ViewBag.Message = ex.Message; ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger; return(View("Error")); }
        }
Exemplo n.º 5
0
        public ActionResult Index(QRCModel ObjQRCModel)
        {
            DARModel            objDAR;
            long                Totalrecords           = 0;
            eTracLoginModel     ObjLoginModel          = new eTracLoginModel();
            LocationMasterModel objLocationMasterModel = null;

            try
            {
                //if (ModelState.IsValid)
                if (true)
                {
                    #region login model
                    ////
                    if (Session["eTrac"] != null)
                    {
                        ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);

                        // ObjQRCModel.UserModel.ProjectID = (ObjLoginModel != null && ObjLoginModel.LocationID > 0) ? (ObjLoginModel.LocationID) : 0;
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Login"));
                    }
                    ///
                    #endregion login model

                    long          _qRCId = 0;
                    Result        _fnResult, result;
                    PrintQRCModel ObjPrintQRCModel;
                    CommonHelper  ObjCommonHelper = new CommonHelper();
                    string        QRCImageName    = string.Empty;
                    //string msg;
                    if (Session["ImageName"] != null)
                    {
                        ObjQRCModel.UserModel.myProfileImage = Convert.ToString(Session["ImageName"]);
                    }

                    if (ObjQRCModel.WarrantyDocument != null)
                    {
                        ObjQRCModel.WarrantyDoc = DateTime.Now.Ticks + "_" + ObjQRCModel.WarrantyDocument.FileName.Replace(" ", "");
                    }
                    if (ObjQRCModel.LOCPicture != null)
                    {
                        ObjQRCModel.LocationPicture = DateTime.Now.Ticks + "_" + ObjQRCModel.LOCPicture.FileName.Replace(" ", "");
                    }
                    if (ObjQRCModel.AssetPictureUrl != null)
                    {
                        ObjQRCModel.AssetPicture = DateTime.Now.Ticks + "_" + ObjQRCModel.AssetPictureUrl.FileName.Replace(" ", "");
                    }

                    ObjQRCModel.CreatedBy  = ObjLoginModel.UserId;
                    ObjQRCModel.LocationId = ObjLoginModel.LocationID;

                    objDAR            = new DARModel();
                    objDAR.LocationId = ObjLoginModel.LocationID;
                    objDAR.UserId     = ObjLoginModel.UserId;
                    objDAR.CreatedBy  = ObjLoginModel.UserId;
                    objDAR.CreatedOn  = DateTime.UtcNow;

                    //Added by Bhushan on 26/Oct/2016 for client has changed request for If QRC is vehicle then directly set vehicle type is Motor Vehicle and for Shuttle Bus  set vehicle type is Shuttle Bus
                    if (ObjQRCModel.QRCTYPE == Convert.ToInt64(QrcType.Vehicle))
                    {
                        ObjQRCModel.VehicleType = Convert.ToInt64(VEHICLETYPE.MotorVehicle);
                    }
                    if (ObjQRCModel.QRCTYPE == Convert.ToInt64(QrcType.ShuttleBus))
                    {
                        ObjQRCModel.VehicleType = Convert.ToInt64(VEHICLETYPE.ShuttleBus);
                    }

                    if (_IQRCSetup.ProcessQRCSetup(ObjQRCModel, out _qRCId, out _fnResult, out ObjPrintQRCModel))
                    {
                        path = Server.MapPath(path);

                        if (ObjQRCModel.WarrantyDocument != null)
                        {
                            ObjCommonHelper.UploadImage(ObjQRCModel.WarrantyDocument, path, ObjQRCModel.WarrantyDoc);
                        }
                        if (ObjQRCModel.LOCPicture != null)
                        {
                            ObjCommonHelper.UploadImage(ObjQRCModel.LOCPicture, path, ObjQRCModel.LocationPicture);
                        }
                        if (ObjQRCModel.AssetPictureUrl != null)
                        {
                            ObjCommonHelper.UploadImage(ObjQRCModel.AssetPictureUrl, path, ObjQRCModel.AssetPicture);
                        }

                        if (_fnResult == Result.Completed)
                        {
                            // Code for to get path of root directory and attach path of directory to store image

                            string RootDirectory = ConfigurationManager.AppSettings["QRCImage"];
                            RootDirectory = Server.MapPath(RootDirectory);
                            if (ObjQRCModel.QRCImageBase64 != null)
                            {
                                ObjQRCModel.QRCImageBase64 = ObjQRCModel.QRCImageBase64.Split(',')[1];
                                ObjCommonHelper.UploadQRCImage(ObjQRCModel.QRCImageBase64, RootDirectory, ObjQRCModel.QRCImage);
                            }

                            objDAR.ActivityDetails = DarMessage.SaveQRC(ObjPrintQRCModel.QRCName, ObjLoginModel.Location);
                            objDAR.TaskType        = (long)TaskTypeCategory.QRCCreation;

                            ViewBag.Message           = CommonMessage.SaveSuccessMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;
                            ModelState.Clear();
                            ObjQRCModel = QRCInIt();
                        }
                        else if (_fnResult == Result.UpdatedSuccessfully)
                        {
                            objDAR.ActivityDetails = DarMessage.UpdateQRC(ObjPrintQRCModel.QRCName, ObjLoginModel.Location);
                            objDAR.TaskType        = (long)TaskTypeCategory.QRCUpdate;

                            ViewBag.Message           = CommonMessage.UpdateSuccessMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;
                            ModelState.Clear();
                            ObjQRCModel = QRCInIt();
                        }
                        else if (_fnResult == Result.Failed)
                        {
                            ViewBag.Message           = CommonMessage.FailureMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
                            // store the failure message in tempdata to display in view.
                        }

                        #region Save DAR
                        result = _ICommonMethod.SaveDAR(objDAR);
                        #endregion Save DAR
                    }
                    else
                    {
                        ViewBag.Message           = CommonMessage.DuplicateRecordMessage();
                        ViewBag.AlertMessageClass = ObjAlertMessageClass.Info;
                        // store the failure message in tempdata to display in view.
                    }
                    //ViewBag.EncryptQRC = Cryptography.GetEncryptedData(QRCDetail.QRCId.ToString(), true);

                    //ViewBag.EncryptQRC = Cryptography.GetEncryptedData(_qRCId.ToString(), true);

                    ViewBag.QRCName     = ObjQRCModel.QRCName;
                    ViewBag.SpecialNote = ObjQRCModel.SpecialNotes;

                    //ViewBag.QRCSize = QRCDetail.DefaultSize;

                    /*
                     *                  ObjPrintQRCModel = new PrintQRCModel();
                     *
                     *
                     *                  /// pull details from ObjQRCModel and plug into ObjPrintQRCModel
                     *                  ObjPrintQRCModel.QRCId = ObjQRCModel.QRCId;
                     *
                     *                  ObjPrintQRCModel.QRCName = ObjQRCModel.QRCName;
                     *                  ObjPrintQRCModel.SpecialNotes = ObjQRCModel.SpecialNotes;
                     *                  ObjPrintQRCModel.QRCTYPE = ObjQRCModel.QRCTYPECaption;
                     *                  ObjPrintQRCModel.VehicleType = ObjQRCModel.VehicleTypeCaption;
                     *                  ObjPrintQRCModel.MotorType = ObjQRCModel.MotorTypeCaption;
                     */


                    /// pull details from ObjQRCModel and plug into ObjPrintQRCModel End

                    ObjPrintQRCModel.QRCSize    = _ICommonMethod.GetGlobalCodeData("QRCSIZE");
                    ObjPrintQRCModel.EncryptQRC = Cryptography.GetEncryptedData(ObjPrintQRCModel.QRCId.ToString(), true);

                    ObjPrintQRCModel.CompanyLogo  = (ObjLoginModel != null && !string.IsNullOrEmpty(ObjLoginModel.LocationLogo)) ? (ObjLoginModel.LocationLogo) : "/";
                    ObjPrintQRCModel.CompanyImage = (ObjLoginModel != null && !string.IsNullOrEmpty(ObjLoginModel.LocationImage)) ? (ObjLoginModel.LocationImage) : "/";
                    ObjPrintQRCModel.CompanyName  = (ObjLoginModel != null && !string.IsNullOrEmpty(ObjLoginModel.Location)) ? (ObjLoginModel.Location) : "/";

                    objLocationMasterModel    = _IGlobalAdmin.GetLocationById(ObjPrintQRCModel.LocationId);
                    ObjPrintQRCModel.Location = objLocationMasterModel.LocationName;

                    //ViewBag.EncryptQRC = ObjPrintQRCModel.EncryptQRC;
                    ViewBag.EncryptQRC     = ObjPrintQRCModel.QRCIDCode;
                    ViewBag.LastEncryptQRC = ObjPrintQRCModel.QRCIDCode;// + ',' + ObjPrintQRCModel.QRCTYPEID;//This field added by Bhushan Dod  //After comma we don't need type of QRC.We need to comment .
                    ViewBag.QRCSize        = ObjPrintQRCModel.QRCSize;

                    //PrintQRCModel ObjPrintQRCModel;
                    ViewBag.QRCModel = ObjPrintQRCModel;
                }
                else
                {
                    var    errors   = ModelState.Values.SelectMany(v => v.Errors);
                    string _message = "";
                    foreach (var items in errors)
                    {
                        _message = _message + items.ErrorMessage;
                    }
                    ViewBag.Message = _message;
                    ObjQRCModel     = _IQRCSetup.GetGlobalCodeForCategories();
                }
            }
            catch (Exception ex)
            {
                WorkOrderEMS.BusinessLogic.Exception_B.Exception_B.exceptionHandel_Runtime(ex, "Exception For File Upload", path.ToString(), null);
                ViewBag.Message           = ex.Message;
                ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
                ObjQRCModel       = _IQRCSetup.GetGlobalCodeForCategories();
                ViewBag.Country   = _ICommonMethod.GetAllcountries();
                ViewBag.PurchType = _ICommonMethod.GetGlobalCodeDataList("PURCHASETYPE");
                return(View(ObjQRCModel));
            }
            ObjQRCModel     = _IQRCSetup.GetGlobalCodeForCategories();
            ViewBag.Country = _ICommonMethod.GetAllcountries();
            // ViewBag.PurchType = _ICommonMethod.GetGlobalCodeDataList("PURCHASETYPE");
            ViewBag.PurchType   = _ICommonMethod.GetGlobalCodeDataList("PURCHASETYPE");
            ViewBag.RefreshMode = true;
            //ViewBag.EncryptLastQRC = data.EncryptLastQRC;
            //ViewBag.EncryptLastQRC = ObjQRCModel.EncryptLastQRC + "," + (string.IsNullOrEmpty(objLocationMasterModel.Address2) ? ObjLoginModel.Location.ToString().Substring(0, 3).ToUpper() : objLocationMasterModel.Address2.ToString().Substring(0, 3).ToUpper());
            //ViewBag.ItemAbberivationList = Convert.ToString(ConfigurationManager.AppSettings["ItemAbberivationList"]);

            //if (ObjLoginModel != null && (ObjLoginModel.UserRoleId == Convert.ToInt64(UserType.GlobalAdmin) || ObjLoginModel.UserRoleId == Convert.ToInt64(UserType.ITAdministrator)))
            //{
            //    //ViewBag.ManagerList = _IGlobalAdmin.GetAllITAdministratorList(0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Manager), out Totalrecords);
            //    ViewBag.LocationList = _IGlobalAdmin.GetAllLocationNew();
            //    ViewBag.AdministratorList = _IGlobalAdmin.GetAllITAdministratorList(0, 0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Administrator), out Totalrecords);
            //}
            //else if (ObjLoginModel != null && (ObjLoginModel.UserRoleId == Convert.ToInt64(UserType.Administrator)))
            //{
            //    ViewBag.LocationList = _IGlobalAdmin.GetAllLocationNew();
            //    //ViewBag.AdministratorList = _IGlobalAdmin.GetAllITAdministratorList(0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Manager), out Totalrecords);
            //    ViewBag.AdministratorList = _ICommonMethod.GetManagersBYLocationId(ObjLoginModel.LocationID);
            //}

            return(View(ObjQRCModel));
            // return RedirectToAction("Index","QRCSetup");
        }