示例#1
0
        /// <summary>
        /// Create SLA
        /// <param name="SLAModel"></param>
        /// </summary>
        public int UpdateStoreSLA(StoreSLAModel SLA)
        {
            List <int> ListSlaID            = new List <int>();
            int        SLATargetUpdateCount = 0;
            DataSet    ds = new DataSet();

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_UpdateStoreSLAMaster", conn);
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@tenant_ID", SLA.TenantID);
                cmd.Parameters.AddWithValue("@modified_By", SLA.CreatedBy);
                cmd.Parameters.AddWithValue("@SLA_ID", SLA.SlaID);
                cmd.Parameters.AddWithValue("@Is_Active", Convert.ToInt16(SLA.isSLAActive));
                cmd.ExecuteScalar();

                if (SLA != null)
                {
                    if (SLA.SLATarget.Count > 0)
                    {
                        for (int k = 0; k < SLA.SLATarget.Count; k++)
                        {
                            MySqlCommand cmdSLA = new MySqlCommand("SP_UpdateStoreSLATargetMaster", conn);
                            cmdSLA.Connection = conn;
                            cmdSLA.Parameters.AddWithValue("@SLATarget_ID", SLA.SLATarget[k].SLATargetID);
                            cmdSLA.Parameters.AddWithValue("@priority_ID", SLA.SLATarget[k].PriorityID);
                            cmdSLA.Parameters.AddWithValue("@priority_SLABreach", SLA.SLATarget[k].SLABreachPercent);
                            cmdSLA.Parameters.AddWithValue("@priority_ResolutionValue", SLA.SLATarget[k].PriorityResolutionValue);
                            cmdSLA.Parameters.AddWithValue("@priority_ResolutionType", SLA.SLATarget[k].PriorityResolutionDuration);
                            cmdSLA.Parameters.AddWithValue("@modified_By", SLA.CreatedBy);
                            cmdSLA.Parameters.AddWithValue("@tenant_ID", SLA.TenantID);
                            cmdSLA.Parameters.AddWithValue("@Sla_ID", SLA.SlaID);
                            cmdSLA.CommandType    = CommandType.StoredProcedure;
                            SLATargetUpdateCount += cmdSLA.ExecuteNonQuery();
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }

            return(SLATargetUpdateCount);
        }
示例#2
0
        public ResponseModel UpdateStoreSLA([FromBody] StoreSLAModel insertSLA)
        {
            int           updatecount       = 0;
            ResponseModel _objResponseModel = new ResponseModel();
            int           StatusCode        = 0;
            string        statusMessage     = "";

            try
            {
                ////Get token (Double encrypted) and get the tenant id
                string       _token       = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(_token));

                StoreSLACaller _newSLA = new StoreSLACaller();

                insertSLA.TenantID  = authenticate.TenantId;
                insertSLA.CreatedBy = authenticate.UserMasterID;
                updatecount         = _newSLA.UpdateStoreSLA(new StoreSLAService(_connectioSting), insertSLA);

                StatusCode =
                    updatecount == 0 ?
                    (int)EnumMaster.StatusCode.RecordAlreadyExists : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);

                _objResponseModel.Status       = true;
                _objResponseModel.StatusCode   = StatusCode;
                _objResponseModel.Message      = statusMessage;
                _objResponseModel.ResponseData = updatecount;
            }
            catch (Exception)
            {
                throw;
            }

            return(_objResponseModel);
        }
示例#3
0
        public int UpdateStoreSLA(IStoreSLA SLA, StoreSLAModel SLAm)
        {
            _SLA = SLA;

            return(_SLA.UpdateStoreSLA(SLAm));
        }
示例#4
0
        public int InsertStoreSLA(IStoreSLA SLA, StoreSLAModel SLAm)
        {
            _SLA = SLA;

            return(_SLA.InsertStoreSLA(SLAm));
        }
示例#5
0
        /// <summary>
        /// Create SLA
        /// <param name="SLAModel"></param>
        /// </summary>
        public int InsertStoreSLA(StoreSLAModel SLA)
        {
            List <int> ListSlaID            = new List <int>();
            int        SLATargetInsertCount = 0;
            DataSet    ds = new DataSet();

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_InsertStoreSLAMaster", conn);
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@_tenantID", SLA.TenantID);
                cmd.Parameters.AddWithValue("@_createdBy", SLA.CreatedBy);
                cmd.Parameters.AddWithValue("@function_ID", string.IsNullOrEmpty(SLA.FunctionID) ? "": SLA.FunctionID.TrimEnd(','));
                cmd.Parameters.AddWithValue("@isSLAActive", Convert.ToInt16(SLA.isSLAActive));

                MySqlDataAdapter da = new MySqlDataAdapter();
                da.SelectCommand = cmd;

                da.Fill(ds);

                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            int slaID = ds.Tables[0].Rows[i]["SLAIDS"] == System.DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["SLAIDS"]);

                            if (slaID > 0)
                            {
                                ListSlaID.Add(slaID);
                            }
                        }
                    }

                    if (ListSlaID.Count > 0)
                    {
                        if (SLA.SLATarget.Count > 0)
                        {
                            for (int k = 0; k < ListSlaID.Count; k++)
                            {
                                for (int j = 0; j < SLA.SLATarget.Count; j++)
                                {
                                    MySqlCommand Targetcmd = new MySqlCommand("SP_InsertStoreSLATarget", conn);
                                    Targetcmd.Connection = conn;
                                    Targetcmd.Parameters.AddWithValue("@_slaID", ListSlaID[k]);
                                    Targetcmd.Parameters.AddWithValue("@_priorityID", SLA.SLATarget[j].PriorityID);
                                    Targetcmd.Parameters.AddWithValue("@_prioritySLABreach", SLA.SLATarget[j].SLABreachPercent);
                                    Targetcmd.Parameters.AddWithValue("@_priorityResolutionValue", SLA.SLATarget[j].PriorityResolutionValue);
                                    Targetcmd.Parameters.AddWithValue("@_priorityResolutionDuraton", SLA.SLATarget[j].PriorityResolutionDuration);
                                    Targetcmd.Parameters.AddWithValue("@_createdBy", SLA.CreatedBy);
                                    Targetcmd.CommandType = CommandType.StoredProcedure;
                                    SLATargetInsertCount += Targetcmd.ExecuteNonQuery();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }

            return(SLATargetInsertCount);
        }