//Hardware Issues Compnent Loading
        public dynamic Loadhwcomponent(Assetmodel oj)
        {
            dynamic obj = new ExpandoObject();

            try
            {
                DataTable dt = Loadhwcomponent_helper(oj);
                if (dt != null && dt.Rows.Count > 0)
                {
                    obj.Status  = "Success";
                    obj.Reason  = "";
                    obj.Details = dt;
                }
                else
                {
                    obj.Status = "Failure";
                    obj.Reason = "No Data Found";
                }
            }
            catch (Exception ex)
            {
                obj.Status = "Failure";
                obj.Reason = GetException(ex.Message);
                return(obj);
            }
            return(obj);
        }
        //Save Hardware Issues
        public dynamic SaveHardwareIssue(Assetmodel root)
        {
            dynamic obj = new ExpandoObject();

            try
            {
                DataTable dt = SaveHardwareIssueSpHelper(root);
                if (dt != null && dt.Rows.Count > 0 && (dt.Rows[0]["REASON"] ?? "").ToString().Contains("Asset Hardware Issue Registered Successfully with UID"))
                {
                    obj.Status = "Success";
                    obj.Reason = "Data Inserted Successfully.Your Token ID is " + "  " + (dt.Rows[0]["REASON"] ?? "").ToString().Replace("Asset Hardware Issue Registered Successfully with UID:", "");
                }
                else
                {
                    obj.Status = "Failure";
                    obj.Reason = dt.Rows[0]["REASON"].ToString();
                }
            }
            catch (Exception ex)
            {
                obj.Status = "Failure";
                obj.Reason = GetException(ex.Message);
            }

            return(obj);
        }
Example #3
0
        public IHttpActionResult SaveHardwareIssue(dynamic data)
        {
            try
            {
                string value = token_gen.Authorize_aesdecrpty(data);

                string     mappath   = HttpContext.Current.Server.MapPath("HardwareIssueSubmitLogs");
                Task       WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_Log(mappath, value));
                Assetmodel rootobj   = JsonConvert.DeserializeObject <Assetmodel>(value);



                //var validresult.Status = "Success";//_valid.CheckSaveAssetTracking(rootobj);
                //if (validresult.Status == "Success")
                //{
                return(Ok(heahel.SaveHardwareIssue(rootobj)));
                //}
                //else
                //{
                //	CatchData.Status = "Failure";
                //	CatchData.Reason = validresult.Reason;
                //	return Ok(CatchData);
                //}
            }
            catch (Exception ex)
            {
                CatchData.Status = "Failure";
                CatchData.Reason = ServicesHelper.ThirdpartyMessage;
                return(Ok(CatchData));
            }
        }
 //Hardware Issue Compnent Loading
 public DataTable Loadhwcomponent_helper(Assetmodel oj)
 {
     try
     {
         cmd = new OracleCommand();
         cmd.InitialLONGFetchSize = 1000;
         cmd.CommandType          = CommandType.StoredProcedure;
         cmd.CommandText          = "GSWS_HARDWARE_ISSUES";
         cmd.Parameters.Add("P_TYPE", OracleDbType.Varchar2, 12).Value         = oj.TYPE;
         cmd.Parameters.Add("P_COMPONENT_ID", OracleDbType.Varchar2, 12).Value = oj.COMPONENTID;
         cmd.Parameters.Add("P_CUR", OracleDbType.RefCursor).Direction         = ParameterDirection.Output;
         DataTable dtstatus = GetgswsDataAdapter(cmd);
         if (dtstatus != null && dtstatus.Rows.Count > 0)
         {
             return(dtstatus);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         string mappath   = HttpContext.Current.Server.MapPath("DataLoadingExceptionLogs");
         Task   WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, "Error From LoadDistricts:" + ex.Message.ToString()));
         throw ex;
     }
 }
 //Reports
 public DataTable LoadRptDistrictSPData(Assetmodel oj)
 {
     try
     {
         cmd = new OracleCommand();
         cmd.InitialLONGFetchSize = 1000;
         cmd.CommandType          = CommandType.StoredProcedure;
         cmd.CommandText          = "GSWS_ASSETS_CNT_REPORT";
         cmd.Parameters.Add("ftype", OracleDbType.Varchar2, 12).Value      = oj.TYPE;
         cmd.Parameters.Add("fdist_id", OracleDbType.Varchar2, 12).Value   = oj.DISTRICT;
         cmd.Parameters.Add("fmandal_id", OracleDbType.Varchar2, 12).Value = oj.MANDAL;
         cmd.Parameters.Add("fsec_id", OracleDbType.Varchar2, 12).Value    = oj.SECRATARIAT;
         cmd.Parameters.Add("p_cur", OracleDbType.RefCursor).Direction     = ParameterDirection.Output;
         DataTable dtstatus = GetgswsDataAdapter(cmd);
         if (dtstatus != null && dtstatus.Rows.Count > 0)
         {
             return(dtstatus);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         string mappath   = HttpContext.Current.Server.MapPath("SeccDataLoadingExceptionLogs");
         Task   WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, "Error From LoadDistricts:" + ex.Message.ToString()));
         throw ex;
     }
 }
Example #6
0
 public IHttpActionResult Loadhwcomponent(dynamic data)
 {
     try
     {
         string value = token_gen.Authorize_aesdecrpty(data);
         //string value = JsonConvert.SerializeObject(data);
         Assetmodel rootobj = JsonConvert.DeserializeObject <Assetmodel>(value);
         return(Ok(heahel.Loadhwcomponent(rootobj)));
     }
     catch (Exception ex)
     {
         CatchData.Status = "Failure";
         CatchData.Reason = ServicesHelper.ThirdpartyMessage;
         return(Ok(CatchData));
     }
 }
        //Save Hardware Issue
        public dynamic SaveHardwareIssueSpHelper(Assetmodel oj)
        {
            try
            {
                //int k = 0;
                cmd = new OracleCommand();
                cmd.InitialLONGFetchSize = 1000;
                cmd.CommandType          = CommandType.StoredProcedure;
                cmd.CommandText          = "GSWS_IN_HARDWARE_ISSUES";
                cmd.Parameters.Add("P_TYPE", OracleDbType.Varchar2, 12).Value            = "1";
                cmd.Parameters.Add("P_DISTRICT", OracleDbType.Varchar2, 12).Value        = oj.DISTRICT;
                cmd.Parameters.Add("P_MANDAL", OracleDbType.Varchar2, 12).Value          = oj.MANDAL;
                cmd.Parameters.Add("P_SECRETARIAT", OracleDbType.Varchar2, 12).Value     = oj.SECRATARIAT;
                cmd.Parameters.Add("P_COMPONENT_NAME", OracleDbType.Varchar2, 200).Value = oj.HWCOMPONENT;
                cmd.Parameters.Add("P_ISSUE_NAME", OracleDbType.Varchar2, 200).Value     = oj.HWISSUE;
                cmd.Parameters.Add("P_REMARKS", OracleDbType.Varchar2, 200).Value        = oj.REMARKS;
                cmd.Parameters.Add("P_IMAGE_URL", OracleDbType.Varchar2, 500).Value      = oj.IMAGEURL;
                cmd.Parameters.Add("P_IP_ADDRESS", OracleDbType.Varchar2, 150).Value     = GetIPAddress();
                cmd.Parameters.Add("P_ENTRY_BY", OracleDbType.Varchar2, 120).Value       = oj.USERNAME;
                cmd.Parameters.Add("P_SOURCE", OracleDbType.Varchar2, 12).Value          = oj.SOURCE;
                cmd.Parameters.Add("p_cur", OracleDbType.RefCursor).Direction            = ParameterDirection.Output;

                DataTable dtstatus = GetgswsDataAdapter(cmd);
                if (dtstatus != null && dtstatus.Rows.Count > 0)
                {
                    return(dtstatus);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                string mappath   = HttpContext.Current.Server.MapPath("HardwareIssuesExceptionLogs");
                Task   WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, "Error From Submit Data:" + ex.Message.ToString()));
                throw ex;
            }
        }