Esempio n. 1
0
    public void GetAllContract()
    {
        int FlagTotalTime;

        colContract = objContract.Get_All_Escalate_Notification();
        foreach (Contract_mst obj in colContract)
        {
            FlagTotalTime = objContract.Get_Contract_Notification_Time(obj.Contractid);
            if (FlagTotalTime <= 0)
            {
                objContractNotification = objContractNotification.Get_By_id(obj.Contractid);
                objContractNotification.Sendnotification = true;
                objContractNotification.Contractid       = obj.Contractid;

                string   varemail    = objContractNotification.Sentto;
                string[] arrEmail    = varemail.Split(',');
                int      lengthCount = Convert.ToInt32(arrEmail.Length.ToString());
                for (int i = 0; i < lengthCount - 1; i++)
                {
                    string emailId = arrEmail[i].ToString();
                    if (emailId != "," && emailId != "")
                    {
                        objEmail.To         = emailId;
                        objEmail.From       = Resources.MessageResource.strEmailFromLevel1Escalate.ToString();
                        objEmail.Subject    = "Contract is About to Expire  -" + obj.Contractname;
                        objEmail.Body       = "Dear Sir, The Contract " + obj.Contractname + " is going to expire on  " + obj.Activeto + " Please send mail to Renew Contract.  Thanks & Regards Admin";
                        objEmail.SmtpServer = Resources.MessageResource.strMailServer.ToString();
                        objEmail.SentMail();
                    }
                }
                objContractNotification.Update();
            }
        }
    }
        public IActionResult PostRead([FromBody] ContractNotification contractNotification
                                      )
        {
            var updated = _repository.MarkAsRead(contractNotification);

            return(StatusCode(201));
        }
        private void SetupMapper_PublisherAsync(ContractStatus notificationStatus)
        {
            ContractNotification expectedModel = GetContractNotification();

            expectedModel.Status = notificationStatus;
            Mock.Get(_mockMapper)
            .Setup(m => m.Map <ContractNotification>(It.IsAny <UpdatedContractStatusResponse>()))
            .Returns(expectedModel)
            .Verifiable();
        }
    protected void BindContractData()
    {
        int contractid = Convert.ToInt32(Request.QueryString[0]);
        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            txtContractName.Text = objContract.Contractname + " " + "Renewed";
            txtdesc.Text = objContract.Description;

            drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid);

            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            ListAsset.DataTextField = "computername";
            ListAsset.DataValueField = "Assetid";
            ListAsset.DataSource = colAsset;
            ListAsset.DataBind();
        }

        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst();
            chkLevel1.Checked = true;
            txtBeforeDays.Text = objContractNotfy.Beforedays.ToString();
            string varEmail = objContractNotfy.Sentto;
            string[] arrEmail = varEmail.Split((",").ToCharArray());
            for (int i = 0; i < arrEmail.Length - 1; i++)
            {
                if (arrEmail[i] != "," && arrEmail[i] != " ")
                {
                    objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]);
                    for (int j = listLevel1.Items.Count - 1; j >= 0; j--)
                    {
                        if (Convert.ToInt32(listLevel1.Items[j].Value) == objEscalateEmail.Id)
                        {
                            listLevel1.Items[j].Selected = true;
                        }
                    }

                }

            }

        }
    }
    protected void BindContractData()
    {
        int contractid = Convert.ToInt16(Request.QueryString[0]);

        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            txtContractName.Text = objContract.Contractname + " " + "Renewed";
            txtdesc.Text         = objContract.Description;

            drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid);

            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            ListAsset.DataTextField  = "computername";
            ListAsset.DataValueField = "Assetid";
            ListAsset.DataSource     = colAsset;
            ListAsset.DataBind();
        }

        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst();
            chkLevel1.Checked  = true;
            txtBeforeDays.Text = objContractNotfy.Beforedays.ToString();
            string   varEmail = objContractNotfy.Sentto;
            string[] arrEmail = varEmail.Split((",").ToCharArray());
            for (int i = 0; i < arrEmail.Length - 1; i++)
            {
                if (arrEmail[i] != "," && arrEmail[i] != " ")
                {
                    objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]);
                    for (int j = listLevel1.Items.Count - 1; j >= 0; j--)
                    {
                        if (Convert.ToInt16(listLevel1.Items[j].Value) == objEscalateEmail.Id)
                        {
                            listLevel1.Items[j].Selected = true;
                        }
                    }
                }
            }
        }
    }
Esempio n. 6
0
        //Add Contract Notifications to DB
        public IEnumerable <Contract> AddContractNotifications(int days)
        {
            //Gets todays date, and adds on number of days dependant on Notification
            DateTime date      = DateTime.Now.AddDays(+days);
            int      exists    = 0;
            var      contracts = _db.Contracts.Where(c => c.DateTo.CompareTo(date) > 0);
            //returns all notifications
            var existingNotifications = _db.ContractNotifications;

            foreach (Contract contract in contracts)
            {
                ContractNotification notification = new ContractNotification();
                notification.ContractId = contract.Id;
                //Perfroms a Switch on Days, for the different Notification Lengths & Assigns type based on these
                switch (days)
                {
                case 30:
                    notification.ContractNotificationTypeId = 1;
                    break;

                case 60:
                    notification.ContractNotificationTypeId = 2;
                    break;

                case 90:
                    notification.ContractNotificationTypeId = 3;
                    break;
                }

                //Performs check to ensure that no Notification of that type exists for that Contract
                foreach (ContractNotification existingNotification in existingNotifications)
                {
                    if (notification.ContractId == existingNotification.ContractId &&
                        notification.ContractNotificationTypeId == existingNotification.ContractNotificationTypeId)
                    {
                        exists = 1;
                    }
                }
                //if not, add to Db
                if (exists == 0)
                {
                    notification.DateAdded = DateTime.Now;
                    _db.ContractNotifications.Add(notification);
                }
            }
            _db.SaveChanges();
            return(contracts);
        }
    protected void BindContract()
    {
        int contractid = Convert.ToInt16(Request.QueryString[0]);
        objContract = objContract.Get_By_id(contractid);
        if (objContract!=null )
        {
            lblContractName.Text = objContract.Contractname;
            lblContractId.Text = objContract.Contractid.ToString();
            lblActiveFrom.Text = objContract.Activefrom.ToString();
            lblActiveTo.Text  = objContract.Activeto.ToString();
            objVendor = objVendor.Get_By_id(objContract.Vendorid);
            lblVendorname.Text = objVendor.Vendorname.ToString();
            lblDesc.Text = objContract.Description.ToString();
            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            grdvwViewAsset.DataSource = colAsset;
            grdvwViewAsset.DataBind();
        }
        objConRenewed = objConRenewed.Get_By_id(contractid);
        if (objConRenewed.Contractid!=0)
        {
            lblRen.Visible = true;
            Contract_mst obj = new Contract_mst();
            obj = obj.Get_By_id(objConRenewed.Contractid);
            lblRenInfo.Text = obj.Contractname;
            lblRenInfo.Visible = true;

        }
        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            lblUsers.Text = objContractNotfy.Sentto;
            lblDays.Text = Convert.ToString(objContractNotfy.Beforedays);

        }
        else
        {
            lblUsers.Text = "-";
            lblDays.Text = "-";

        }
    }
Esempio n. 8
0
    protected void BindContract()
    {
        int contractid = Convert.ToInt16(Request.QueryString[0]);

        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            lblContractName.Text      = objContract.Contractname;
            lblContractId.Text        = objContract.Contractid.ToString();
            lblActiveFrom.Text        = objContract.Activefrom.ToString();
            lblActiveTo.Text          = objContract.Activeto.ToString();
            objVendor                 = objVendor.Get_By_id(objContract.Vendorid);
            lblVendorname.Text        = objVendor.Vendorname.ToString();
            lblDesc.Text              = objContract.Description.ToString();
            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            grdvwViewAsset.DataSource = colAsset;
            grdvwViewAsset.DataBind();
        }
        objConRenewed = objConRenewed.Get_By_id(contractid);
        if (objConRenewed.Contractid != 0)
        {
            lblRen.Visible = true;
            Contract_mst obj = new Contract_mst();
            obj                = obj.Get_By_id(objConRenewed.Contractid);
            lblRenInfo.Text    = obj.Contractname;
            lblRenInfo.Visible = true;
        }
        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            lblUsers.Text = objContractNotfy.Sentto;
            lblDays.Text  = Convert.ToString(objContractNotfy.Beforedays);
        }
        else
        {
            lblUsers.Text = "-";
            lblDays.Text  = "-";
        }
    }
Esempio n. 9
0
        protected void AddContractNotification <T>(AppDbContext context, string message, T contract) where T : ContractOutput, IBasicEmail, new()
        {
            var contractNotification = new ContractNotification()
            {
                RequiresAcknowledgement = false,
                UserId         = contract.TargetPersonId,
                OrganizationId = contract.TargetOrganizationId,

                ContractId = contract.Id,
                Message    = message,
                Url        = contract.GetContractUrl(contract)
            };

            context.ContractNotifications.Add(contractNotification);

            var result = context.SaveChanges(true);

            _logger.LogDebug(GetLogMessage("{0} results updated"), result);
        }
    public void GetAllContract()
    {
        int FlagTotalTime;
        colContract = objContract.Get_All_Escalate_Notification();
        foreach (Contract_mst obj in colContract)
        {
            FlagTotalTime = objContract.Get_Contract_Notification_Time(obj.Contractid);
            if (FlagTotalTime <= 0 )
            {
                objContractNotification = objContractNotification.Get_By_id(obj.Contractid);
                objContractNotification.Sendnotification = true ;
                objContractNotification.Contractid = obj.Contractid;

                string varemail = objContractNotification.Sentto;
                string[] arrEmail = varemail.Split(',');
                int lengthCount = Convert.ToInt32(arrEmail.Length.ToString());
                for (int i = 0; i < lengthCount - 1; i++)
                {
                    string emailId = arrEmail[i].ToString();
                    if (emailId != "," && emailId != "")
                    {

                                objEmail.To = emailId;
                                objEmail.From = Resources.MessageResource.strEmailFromLevel1Escalate.ToString();
                                objEmail.Subject = "Contract is About to Expire  -" + obj.Contractname;
                                objEmail.Body = "Dear Sir, The Contract " + obj.Contractname + " is going to expire on  " + obj.Activeto  + " Please send mail to Renew Contract.  Thanks & Regards Admin";
                                objEmail.SmtpServer = Resources.MessageResource.strMailServer.ToString();
                                objEmail.SentMail();

                      }

                    }
                 objContractNotification.Update();

                }

            }
    }
    protected void BindContractData()
    {
        int contractid = Convert.ToInt32(Request.QueryString[0]);

        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            string dd;
            string mm;
            string yy;
            txtContractName.Text = objContract.Contractname;
            txtdesc.Text         = objContract.Description.ToString();
            string[] tempdate = objContract.Activefrom.ToString().Split(("/").ToCharArray());
            string   StrData  = tempdate[2].ToString();
            string[] temp1    = StrData.Split((" ").ToCharArray());

            if (Convert.ToInt32(tempdate[1]) < 10)
            {
                dd = "0" + tempdate[1];
            }
            else
            {
                dd = tempdate[1];
            }
            if (Convert.ToInt32(tempdate[0]) < 10)
            {
                mm = "0" + tempdate[0];
            }
            else
            {
                mm = tempdate[0];
            }
            string vardateFrom = dd + "/" + mm + "/" + temp1[0];
            txtActiveFrom.Text = vardateFrom;


            string[] tempdate1 = objContract.Activeto.ToString().Split(("/").ToCharArray());
            string   StrData1  = tempdate1[2].ToString();
            string[] temp2     = StrData1.Split((" ").ToCharArray());

            if (Convert.ToInt32(tempdate1[1]) < 10)
            {
                dd = "0" + tempdate1[1];
            }
            else
            {
                dd = tempdate1[1];
            }
            if (Convert.ToInt32(tempdate1[0]) < 10)
            {
                mm = "0" + tempdate1[0];
            }
            else
            {
                mm = tempdate1[0];
            }
            string vardateTo = dd + "/" + mm + "/" + temp2[0];


            txtActiveTo.Text        = vardateTo;
            drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid);

            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            ListAsset.DataTextField  = "computername";
            ListAsset.DataValueField = "Assetid";
            ListAsset.DataSource     = colAsset;
            ListAsset.DataBind();
        }

        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst();
            chkLevel1.Checked  = true;
            txtBeforeDays.Text = objContractNotfy.Beforedays.ToString();
            string   varEmail = objContractNotfy.Sentto;
            string[] arrEmail = varEmail.Split((",").ToCharArray());
            for (int i = 0; i < arrEmail.Length - 1; i++)
            {
                if (arrEmail[i] != "," && arrEmail[i] != " ")
                {
                    objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]);
                    for (int j = listLevel1.Items.Count - 1; j >= 0; j--)
                    {
                        if (Convert.ToInt32(listLevel1.Items[j].Value) == objEscalateEmail.Id)
                        {
                            listLevel1.Items[j].Selected = true;
                        }
                    }
                }
            }
        }
    }
    protected void BindContractData()
    {
        int contractid = Convert.ToInt16(Request.QueryString[0]);
        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            string dd;
            string mm;
            string yy;
            txtContractName.Text  = objContract.Contractname;
            txtdesc.Text  = objContract.Description.ToString();
            string[] tempdate =  objContract.Activefrom.ToString().Split(("/").ToCharArray());
            string StrData = tempdate[2].ToString();
            string[] temp1 = StrData.Split((" ").ToCharArray());

            if (Convert.ToInt16(tempdate[1]) < 10)
            {
                dd = "0" + tempdate[1];
            }
            else
            {
                dd =  tempdate[1];

            }
            if (Convert.ToInt16(tempdate[0]) < 10)
            {
                mm = "0" + tempdate[0];
            }
            else
            {
                mm = tempdate[0];

            }
            string vardateFrom = dd + "/" + mm + "/" + temp1[0];
            txtActiveFrom.Text = vardateFrom;

            string[] tempdate1 = objContract.Activeto.ToString().Split(("/").ToCharArray());
            string StrData1 = tempdate1[2].ToString();
            string[] temp2 = StrData1.Split((" ").ToCharArray());

            if (Convert.ToInt16(tempdate1[1]) < 10)
            {
                dd = "0" + tempdate1[1];
            }
            else
            {
                dd = tempdate1[1];

            }
            if (Convert.ToInt16(tempdate1[0]) < 10)
            {
                mm = "0" + tempdate1[0];
            }
            else
            {
                mm = tempdate1[0];

            }
            string vardateTo = dd + "/" + mm + "/" + temp2[0];

            txtActiveTo.Text = vardateTo;
            drpVendor.SelectedValue  = Convert.ToString(objContract.Vendorid);

            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            ListAsset.DataTextField = "computername";
            ListAsset.DataValueField = "Assetid";
            ListAsset.DataSource = colAsset;
            ListAsset.DataBind();
        }

        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid!=0)
        {
            EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst();
            chkLevel1.Checked = true;
            txtBeforeDays.Text = objContractNotfy.Beforedays.ToString();
            string varEmail = objContractNotfy.Sentto;
            string[] arrEmail = varEmail.Split((",").ToCharArray());
            for (int i = 0; i < arrEmail.Length - 1; i++)
            {
                if (arrEmail[i] != "," && arrEmail[i] != " ")
                {
                    objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]);
                    for (int j = listLevel1.Items.Count - 1; j >= 0; j--)
                    {
                        if (Convert.ToInt16(listLevel1.Items[j].Value) == objEscalateEmail.Id)
                        {
                            listLevel1.Items[j].Selected = true;
                        }
                    }

                }

            }

        }
    }
Esempio n. 13
0
 public ContractNotification MarkAsRead(ContractNotification contractNotification)
 {
     _db.Entry(contractNotification).State = EntityState.Modified;
     _db.SaveChanges();
     return(contractNotification);
 }
Esempio n. 14
0
 public ContractNotification AddContractNotification(ContractNotification contractNotification)
 {
     _db.ContractNotifications.Add(contractNotification);
     _db.SaveChanges();
     return(contractNotification);
 }
 private void ForMemberFix(UpdatedContractStatusResponse src, ContractNotification dest)
 {
     dest.Status = src.NewStatus;
 }
 public int Update_ContractNotification_By_id(ContractNotification objContractNotification)
 {
     return (int)ExecuteNonQuery(sp_ContractNotification_Update, new object[] { objContractNotification.Sentto, objContractNotification.Sendnotification, objContractNotification.Contractid, objContractNotification.Beforedays });
 }
 public int Insert_ContractNotification(ContractNotification objContractNotification)
 {
     return (int)ExecuteNonQuery(sp_ContractNotification_Insert, new object[] { objContractNotification.Sentto, objContractNotification.Sendnotification, objContractNotification.Contractid, objContractNotification.Beforedays });
 }
    public object GenerateContractNotificationObject(ref IDataReader returnData)
    {
        ContractNotification obj = new ContractNotification();
        while (returnData.Read())
        {

            obj.Contractid = (int)returnData["Contractid"];
            obj.Beforedays = (int)returnData["Beforedays"];
            obj.Sentto = (string)returnData["Sentto"];
            obj.Sendnotification = (bool)returnData["Sendnotification"];

        }
        returnData.Close();
        returnData.Dispose();
        return obj;
    }
    public CollectionBase GenerateContractNotificationCollection(ref IDataReader returnData)
    {
        BLLCollection<ContractNotification> col = new BLLCollection<ContractNotification>();
        while (returnData.Read())
        {

            ContractNotification obj = new ContractNotification();
            obj.Contractid = (int)returnData["Contractid"];
            obj.Beforedays = (int)returnData["Beforedays"];
            obj.Sentto = (string)returnData["Sentto"];
            obj.Sendnotification = (bool)returnData["Sendnotification"];

            col.Add(obj);
        }
        returnData.Close();
        returnData.Dispose();
        return col;
    }