protected void BindGrid()
    {
        int TotalSpentTimeInMins = 0;
        int filterid = Convert.ToInt16(drpFilter.SelectedValue);
        BLLCollection<Contract_mst> col = new BLLCollection<Contract_mst>();
        colContract = objContract.Get_All();
        foreach (Contract_mst obj in colContract)
        {
            Contract_mst objCon = new Contract_mst();
            objCon = obj.Get_By_id(obj.Contractid);
            if (filterid == 1)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins>0)
                 {
                     col.Add(objCon);
                 }

            }
            if (filterid == 2)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins <= 0)
                {
                    col.Add(objCon);
                }

            }
            if (filterid == 3)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins <= 0 && TotalSpentTimeInMins > (-10080))
                {
                    col.Add(objCon);
                }

            }
            if (filterid == 4)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins >0 && TotalSpentTimeInMins < 10080)
                {
                    col.Add(objCon);
                }

            }
            if (filterid == 5)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins > 0 && TotalSpentTimeInMins < 21600)
                {
                    col.Add(objCon);
                }

            }

        }
        grvwContract.DataSource = col;
        grvwContract.DataBind();
    }
Exemplo n.º 2
0
 protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e)
 {
     //Add Exception handilng try catch change by vishal 21-05-2012
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             // Hndling GridView RowDataBound  Event for Binding vendorid to Vendor name
             int vendorid = Convert.ToInt32(e.Row.Cells[5].Text);
             objVendor           = objVendor.Get_By_id(vendorid);
             e.Row.Cells[5].Text = objVendor.Vendorname.ToString();
             int contractid = Convert.ToInt32(e.Row.Cells[1].Text);
             objContract = objContract.Get_By_id(contractid);
             int   TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto);
             Label lbl = ((Label)e.Row.FindControl("lblActive"));
             if (TotalSpentTimeInMins > 0)
             {
                 lbl.Text = "Active";
             }
             else
             {
                 lbl.Text = "Not Active";
             }
         }
     }
     catch (Exception ex)
     {
         string myScript;
         myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
         Page.RegisterClientScriptBlock("MyScript", myScript);
         return;
     }
 }
Exemplo n.º 3
0
    protected void BindGrid()
    {
        int TotalSpentTimeInMins         = 0;
        int filterid                     = Convert.ToInt16(drpFilter.SelectedValue);
        BLLCollection <Contract_mst> col = new BLLCollection <Contract_mst>();

        colContract = objContract.Get_All();
        foreach (Contract_mst obj in colContract)
        {
            Contract_mst objCon = new Contract_mst();
            objCon = obj.Get_By_id(obj.Contractid);
            if (filterid == 1)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins > 0)
                {
                    col.Add(objCon);
                }
            }
            if (filterid == 2)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins <= 0)
                {
                    col.Add(objCon);
                }
            }
            if (filterid == 3)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins <= 0 && TotalSpentTimeInMins > (-10080))
                {
                    col.Add(objCon);
                }
            }
            if (filterid == 4)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins > 0 && TotalSpentTimeInMins < 10080)
                {
                    col.Add(objCon);
                }
            }
            if (filterid == 5)
            {
                TotalSpentTimeInMins = obj.Get_Contract_Status(objCon.Activeto);
                if (TotalSpentTimeInMins > 0 && TotalSpentTimeInMins < 21600)
                {
                    col.Add(objCon);
                }
            }
        }
        grvwContract.DataSource = col;
        grvwContract.DataBind();
    }
    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;
                        }
                    }
                }
            }
        }
    }
    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 = "-";

        }
    }
Exemplo n.º 7
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  = "-";
        }
    }
Exemplo n.º 8
0
 protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         // Hndling GridView RowDataBound  Event for Binding vendorid to Vendor name
         int vendorid = Convert.ToInt16(e.Row.Cells[5].Text);
         objVendor           = objVendor.Get_By_id(vendorid);
         e.Row.Cells[5].Text = objVendor.Vendorname.ToString();
         int contractid = Convert.ToInt16(e.Row.Cells[1].Text);
         objContract = objContract.Get_By_id(contractid);
         int   TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto);
         Label lbl = ((Label)e.Row.FindControl("lblActive"));
         if (TotalSpentTimeInMins > 0)
         {
             lbl.Text = "Active";
         }
         else
         {
             lbl.Text = "Not Active";
         }
     }
 }
    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;
                        }
                    }
                }
            }
        }
    }
 public int Update_Contract_mst_By_id(Contract_mst objContract_mst)
 {
     return (int)ExecuteNonQuery(sp_Contract_Update, new object[] { objContract_mst.Vendorid, objContract_mst.Description, objContract_mst.Contractname, objContract_mst.Contractid, objContract_mst.Activeto, objContract_mst.Activefrom });
 }
 public int Insert_Contract_mst(Contract_mst objContract_mst)
 {
     return (int)ExecuteNonQuery(sp_Contract_Insert, new object[] { objContract_mst.Vendorid, objContract_mst.Description, objContract_mst.Contractname, objContract_mst.Activeto, objContract_mst.Activefrom });
 }
    public object GenerateContract_mstObject(ref IDataReader returnData)
    {
        Contract_mst obj = new Contract_mst();
        while (returnData.Read())
        {

            obj.Contractid = (int)returnData["Contractid"];
            obj.Contractname = (string)returnData["Contractname"];
            obj.Vendorid = (int)returnData["Vendorid"];
            obj.Description = (string)returnData["Description"];
            DateTime Mydatetime = new DateTime();
            Mydatetime = (DateTime)returnData["Activefrom"];
            obj.Activefrom = Mydatetime.ToString();
            DateTime Mydatetime1 = new DateTime();
            Mydatetime1 = (DateTime)returnData["Activeto"];
            obj.Activeto = Mydatetime1.ToString();
            DateTime Mydatetime2 = new DateTime();
            Mydatetime2 = (DateTime)returnData["CreateDateTime"];
            obj.CreateDateTime = Mydatetime2.ToString();

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

            Contract_mst obj = new Contract_mst();
            obj.Contractid = (int)returnData["Contractid"];
            obj.Contractname = (string)returnData["Contractname"];
            obj.Vendorid = (int)returnData["Vendorid"];
            obj.Description = (string)returnData["Description"];
            DateTime Mydatetime = new DateTime();
            Mydatetime = (DateTime)returnData["Activefrom"];
            obj.Activefrom = Mydatetime.ToString();
            DateTime Mydatetime1 = new DateTime();
            Mydatetime1 = (DateTime)returnData["Activeto"];
            obj.Activeto = Mydatetime1.ToString();
            DateTime Mydatetime2 = new DateTime();
            Mydatetime2 = (DateTime)returnData["CreateDateTime"];
            obj.CreateDateTime = Mydatetime2.ToString();

            col.Add(obj);
        }
        returnData.Close();
        returnData.Dispose();
        return col;
    }
    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;
                        }
                    }

                }

            }

        }
    }
    protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            // Hndling GridView RowDataBound  Event for Binding vendorid to Vendor name
            int vendorid = Convert.ToInt16(e.Row.Cells[5].Text);
            objVendor = objVendor.Get_By_id(vendorid);
            e.Row.Cells[5].Text = objVendor.Vendorname.ToString();
            int contractid = Convert.ToInt16(e.Row.Cells[1].Text);
            objContract = objContract.Get_By_id(contractid);
            int TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto);
            Label lbl = ((Label)e.Row.FindControl("lblActive"));
            if (TotalSpentTimeInMins > 0)
            {
                lbl.Text = "Active";

            }
            else { lbl.Text = "Not Active"; }

        }
    }
    protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        //Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Hndling GridView RowDataBound  Event for Binding vendorid to Vendor name
                int vendorid = Convert.ToInt32(e.Row.Cells[5].Text);
                objVendor = objVendor.Get_By_id(vendorid);
                e.Row.Cells[5].Text = objVendor.Vendorname.ToString();
                int contractid = Convert.ToInt32(e.Row.Cells[1].Text);
                objContract = objContract.Get_By_id(contractid);
                int TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto);
                Label lbl = ((Label)e.Row.FindControl("lblActive"));
                if (TotalSpentTimeInMins > 0)
                {
                    lbl.Text = "Active";

                }
                else { lbl.Text = "Not Active"; }

            }
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }