示例#1
0
    public void Asset_Product_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");

        inventorydate2 = inventory_date.InnerText;
        XmlNode               product_name         = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//Name");
        XmlNode               product_manufacturer = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//Manufacturer");
        XmlNode               Serial_number        = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//Serial_number");
        XmlNode               UUID        = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//UUID");
        XmlNode               SKU_number  = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//SKU_number");
        Asset_mst             objAsset    = new Asset_mst();
        int                   varassetid  = objAsset.Get_Current_Assetid();
        Asset_ProductInfo_mst objprodinfo = new Asset_ProductInfo_mst();

        if (count1 == 0)
        {
            objprodinfo.Assetid = varassetid;
        }
        else
        {
            objprodinfo.Assetid = Assetid;
        }
        objprodinfo.Inventory_date       = inventorydate2;
        objprodinfo.Product_manufacturer = product_manufacturer.InnerText;
        objprodinfo.Product_name         = product_name.InnerText;
        objprodinfo.Serial_number        = Serial_number.InnerText;
        objprodinfo.Sku_no = SKU_number.InnerText;
        objprodinfo.Uuid   = UUID.InnerText;
        objprodinfo.Insert();
    }
    protected void BindListBox()
    {
        txtContractName.Text    = Session["contractname"].ToString();
        txtdesc.Text            = Session["description"].ToString();
        drpVendor.SelectedValue = Session["vendorid"].ToString();
        Asset_mst ObjAsset            = new Asset_mst();
        BLLCollection <Asset_mst> col = new BLLCollection <Asset_mst>();
        string varAsset = Session["AssetContract"].ToString();

        string[] arrAsset  = varAsset.Split(',');
        int      FlagCount = arrAsset.Length;

        for (int i = 0; i < FlagCount; i++)
        {
            if (arrAsset[i] != "," && arrAsset[i] != "")
            {
                Asset_mst obj = new Asset_mst();
                obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString()));
                col.Add(obj);
            }
        }
        ListAsset.DataTextField  = "computerName";
        ListAsset.DataValueField = "assetid";
        ListAsset.DataSource     = col;
        ListAsset.DataBind();
        Session["AssetContract"] = "";
    }
示例#3
0
    protected void btnAddAsset_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow gv in grdvwViewAsset.Rows)
        {
            string gvIDs;
            // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
            CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
            // If deleteChkBxItem is Checked then ,mapped Current site to this user
            if (deleteChkBxItem.Checked)
            {
                ListItem item = new ListItem();
                int      varSiteid;
                int      FlagCheckAsset = 0;
                // Get the Site Id from variable of Label type declare in GridView of grdvwSite
                gvIDs = ((Label)gv.FindControl("assetid")).Text.ToString();


                ObjAsset   = ObjAsset.Get_By_id(Convert.ToInt16(gvIDs));
                item.Text  = ObjAsset.Computername;
                item.Value = Convert.ToString(ObjAsset.Assetid);

                for (int i = listAsset.Items.Count - 1; i >= 0; i--)
                {
                    if (Convert.ToInt16(listAsset.Items[i].Value) == ObjAsset.Assetid)
                    {
                        FlagCheckAsset = 1;
                    }
                }
                if (FlagCheckAsset == 0)
                {
                    listAsset.Items.Add(item);
                }
            }
        }
    }
 public void BindGrid()
 {
     DataTable dtTable = new DataTable();
     dtTable = CreateDataTable();
     Asset_mst objAsset = new Asset_mst();
     BLLCollection<Asset_mst> colAsset = new BLLCollection<Asset_mst>();
     colAsset = objAsset.Get_All();
     foreach (Asset_mst obj in colAsset)
     {
         DataRow row;
         row = dtTable.NewRow();
         row["computername"] = Convert.ToString(obj.Computername);
         assetid = Convert.ToInt16(obj.Assetid);
         Asset_OperatingSystem_mst objos = new Asset_OperatingSystem_mst();
         objos = objos.Get_By_Assetid(assetid);
         row["osname"] = Convert.ToString(objos.Os_name);
         row["username"] = Convert.ToString(objos.User_name);
         row["productkey"] = Convert.ToString(objos.Product_key);
         Asset_ProductInfo_mst objproduct = new Asset_ProductInfo_mst();
         objproduct = objproduct.Get_By_Assetid(assetid);
         row["productname"] = Convert.ToString(objproduct.Product_name);
         row["productmanu"] = Convert.ToString(objproduct.Product_manufacturer);
         row["serialno"] = Convert.ToString(objproduct.Serial_number);
         Asset_Processor_mst objprocessor = new Asset_Processor_mst();
         objprocessor = objprocessor.Get_By_Assetid(assetid);
         row["processorname"] = Convert.ToString(objprocessor.Processor_name);
         Asset_Memory_mst objmemory = new Asset_Memory_mst();
         objmemory = objmemory.Get_By_Assetid(assetid);
         row["physicalmemory"] = Convert.ToString(objmemory.Physical_mem);
         dtTable.Rows.Add(row);
     }
     dtgrid.DataSource = dtTable;
     dtgrid.DataBind();
 }
    protected void BindListBox()
    {
        txtContractName.Text = Session["contractname"].ToString();
        txtdesc.Text = Session["description"].ToString();
        drpVendor.SelectedValue = Session["vendorid"].ToString();
        Asset_mst ObjAsset = new Asset_mst();
        BLLCollection<Asset_mst> col = new BLLCollection<Asset_mst>();
        string varAsset = Session["AssetContract"].ToString();
        string[] arrAsset = varAsset.Split(',');
        int FlagCount = arrAsset.Length;
        for (int i = 0; i < FlagCount; i++)
        {
            if (arrAsset[i] != "," && arrAsset[i]!="")
            {
                Asset_mst obj = new Asset_mst();
                obj = ObjAsset.Get_By_id(Convert.ToInt16(arrAsset[i].ToString()));
                col.Add(obj);
            }

        }
        ListAsset.DataTextField = "computerName";
        ListAsset.DataValueField = "assetid";
        ListAsset.DataSource = col;
        ListAsset.DataBind();
        Session["AssetContract"] = "";
    }
    protected void BindListBox()
    {
        int       contractid          = Convert.ToInt32(Request.QueryString[0]);
        Asset_mst ObjAsset            = new Asset_mst();
        BLLCollection <Asset_mst> col = new BLLCollection <Asset_mst>();
        string varAsset = Session["AssetContract"].ToString();

        string[] arrAsset  = varAsset.Split(',');
        int      FlagCount = arrAsset.Length;

        for (int i = 0; i < FlagCount; i++)
        {
            if (arrAsset[i] != "," && arrAsset[i] != "")
            {
                ContractToAssetMapping objCoAsset = new ContractToAssetMapping();
                ListItem  item = new ListItem();
                int       flagcount;
                Asset_mst obj = new Asset_mst();
                obj       = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString()));
                flagcount = objCoAsset.Get_by_Contractid_Assetid(contractid, Convert.ToInt32(arrAsset[i].ToString()));
                if (flagcount == 0)
                {
                    item.Text  = obj.Computername;
                    item.Value = Convert.ToString(obj.Assetid);
                    ListAsset.Items.Add(item);
                }
            }
        }
    }
示例#7
0
    public void Asset_Info(XmlDocument xmldoc)
    {
        Asset_mst objAsset = new Asset_mst();
        int       count;
        string    compname1, domain1;
        XmlNode   compname       = xmldoc.DocumentElement.SelectSingleNode("//Computer//Computer_name");
        XmlNode   inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
        XmlNode   domain         = xmldoc.DocumentElement.SelectSingleNode("//Computer//Domain");

        compname1 = compname.InnerText;
        domain1   = domain.InnerText;
        count     = objAsset.Get_ComputerName(compname1, domain1);
        count1    = count;
        if (count == 0)
        {
            objAsset.Computername   = compname.InnerText;
            objAsset.Domain         = domain.InnerText;
            objAsset.Createdatetime = inventory_date.InnerText;
            objAsset.Insert();
        }
        else
        {
            objAsset       = objAsset.Get_AssetId_By_ComputerName_Domain(compname1, domain1);
            Assetid        = Convert.ToInt16(objAsset.Assetid);
            inventorydate2 = inventory_date.InnerText;
        }
    }
示例#8
0
    public void Asset_Inventory_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");

        inventorydate2 = inventory_date.InnerText;
        int     countinventorydetails;
        XmlNode compname = xmldoc.DocumentElement.SelectSingleNode("//Computer//Computer_name");
        XmlNode domain   = xmldoc.DocumentElement.SelectSingleNode("//Computer//Domain");


        Asset_mst           objAsset     = new Asset_mst();
        int                 varassetid   = objAsset.Get_Current_Assetid();
        Asset_Inventory_mst objinventory = new Asset_Inventory_mst();

        if (count1 == 0)
        {
            objinventory.Assetid = varassetid;
        }
        else
        {
            objinventory.Assetid  = Assetid;
            countinventorydetails = objinventory.Get_Inventory_By_Assetid_InventoryDate(Assetid, inventorydate2);
            if (countinventorydetails != 0)
            {
                objinventory.delete_Existingdetails_From_Asset(Assetid, inventorydate2);
            }
        }

        objinventory.Computername  = compname.InnerText;
        objinventory.Inventorydate = inventory_date.InnerText;
        objinventory.Insert();
    }
    public void Asset_Inventory_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
        inventorydate2 = inventory_date.InnerText;
        int countinventorydetails;
        XmlNode compname = xmldoc.DocumentElement.SelectSingleNode("//Computer//Computer_name");
        XmlNode domain = xmldoc.DocumentElement.SelectSingleNode("//Computer//Domain");

        Asset_mst objAsset = new Asset_mst();
        int varassetid = objAsset.Get_Current_Assetid();
        Asset_Inventory_mst objinventory = new Asset_Inventory_mst();
        if (count1 == 0)
        {
            objinventory.Assetid = varassetid;
        }
        else
        {
            objinventory.Assetid = Assetid;
            countinventorydetails = objinventory.Get_Inventory_By_Assetid_InventoryDate(Assetid, inventorydate2);
            if(countinventorydetails!=0)
            {
                objinventory.delete_Existingdetails_From_Asset(Assetid, inventorydate2);
            }
        }

        objinventory.Computername = compname.InnerText;
        objinventory.Inventorydate = inventory_date.InnerText;
        objinventory.Insert();
    }
    protected void BindListBox()
    {
        drpCategory.SelectedValue    = Session["Categoryid"].ToString();
        drpSubcategory.SelectedValue = Session["Subcategoryid"].ToString();
        drpTechnician.SelectedValue  = Session["Technician"].ToString();
        txtTitle.Text = Session["Title"].ToString();
        drpchangetype.SelectedValue = Session["Changetype"].ToString();

        Asset_mst ObjAsset            = new Asset_mst();
        BLLCollection <Asset_mst> col = new BLLCollection <Asset_mst>();
        string varAsset = Session["AssetContract"].ToString();

        string[] arrAsset  = varAsset.Split(',');
        int      FlagCount = arrAsset.Length;

        for (int i = 0; i < FlagCount; i++)
        {
            if (arrAsset[i] != "," && arrAsset[i] != "")
            {
                Asset_mst obj = new Asset_mst();
                obj = ObjAsset.Get_By_id(Convert.ToInt16(arrAsset[i].ToString()));
                col.Add(obj);
            }
        }
        ListAsset.DataTextField  = "computerName";
        ListAsset.DataValueField = "assetid";
        ListAsset.DataSource     = col;
        ListAsset.DataBind();
        for (int i = ListAsset.Items.Count - 1; i >= 0; i--)
        {
            ListAsset.Items[i].Selected = true;
        }
        Session["AssetContract"] = "";
    }
    public void Asset_Info(XmlDocument xmldoc)
    {
        try
        {
            Asset_mst objAsset = new Asset_mst();
            int count;
            string compname1, domain1;
            XmlNode compname = xmldoc.DocumentElement.SelectSingleNode("//Computer//Computer_name");
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            XmlNode domain = xmldoc.DocumentElement.SelectSingleNode("//Computer//Domain");

            compname1 = compname.InnerText;
            domain1 = domain.InnerText;
            count = objAsset.Get_ComputerName(compname1, domain1);
            count1 = count;
            if (count == 0)
            {
                objAsset.Computername = compname.InnerText;
                objAsset.Domain = domain.InnerText;
                objAsset.Createdatetime = inventory_date.InnerText;
                objAsset.Insert();
            }
            else
            {
                objAsset = objAsset.Get_AssetId_By_ComputerName_Domain(compname1, domain1);
                Assetid = Convert.ToInt32(objAsset.Assetid);
                inventorydate2 = inventory_date.InnerText;
            }
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
示例#12
0
    public void Asset_Processor_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");

        inventorydate2 = inventory_date.InnerText;
        XmlNode             Family       = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Family");
        XmlNode             Manufacturer = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Manufacturer");
        XmlNode             Max_speed    = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Max_speed");
        XmlNode             Model        = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Model");
        XmlNode             processors   = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Processor");
        XmlNode             Speed        = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Speed");
        XmlNode             Stepping     = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Stepping");
        Asset_mst           objAsset     = new Asset_mst();
        int                 varassetid   = objAsset.Get_Current_Assetid();
        Asset_Processor_mst objprocessor = new Asset_Processor_mst();

        if (count1 == 0)
        {
            objprocessor.Assetid = varassetid;
        }
        else
        {
            objprocessor.Assetid = Assetid;
        }

        objprocessor.Family         = Family.InnerText;
        objprocessor.Inventory_date = inventorydate2;
        objprocessor.Manufacturer   = Manufacturer.InnerText;
        objprocessor.Max_speed      = Max_speed.InnerText;
        objprocessor.Model          = Model.InnerText;
        objprocessor.Processor_name = processors.InnerText;
        objprocessor.Speed          = Speed.InnerText;
        objprocessor.Stepping       = Stepping.InnerText;
        objprocessor.Insert();
    }
示例#13
0
    public void Asset_Network_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");

        inventorydate2 = inventory_date.InnerText;
        XmlNode adapter  = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter");
        XmlNode protocol = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter//Network_protocols//Protocol");
        XmlNode protocol_IP_Addresses_Address = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter//Network_protocols//Protocol//IP_Addresses//Address//Address");
        XmlNode protocol_Gateways             = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter//Network_protocols//Protocol//Gateways");
        XmlNode Link_speed = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Link_speed");

        Asset_mst         objAsset   = new Asset_mst();
        int               varassetid = objAsset.Get_Current_Assetid();
        Asset_Network_mst objnetwork = new Asset_Network_mst();

        objnetwork.Adapter_name = adapter.InnerText;
        if (count1 == 0)
        {
            objnetwork.Assetid = varassetid;
        }
        else
        {
            objnetwork.Assetid = Assetid;
        }

        objnetwork.Gateway        = protocol_Gateways.InnerText;
        objnetwork.Inventory_date = inventorydate2;
        objnetwork.Ip_address     = protocol_IP_Addresses_Address.InnerText;
        objnetwork.Link_speed     = Link_speed.InnerText;
        objnetwork.Protocol_name  = protocol.InnerText;
        objnetwork.Insert();
    }
示例#14
0
    public void Asset_Physical_Drive_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");

        inventorydate2 = inventory_date.InnerText;
        XmlNode   physical_drives           = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Drive");
        XmlNode   Capacity                  = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Capacity");
        XmlNode   Manufacturer              = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Manufacturer");
        XmlNode   physical_drives1          = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Product_version");
        XmlNode   Product_version           = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Drive");
        XmlNode   Serial_number             = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Serial_number");
        Asset_mst objAsset                  = new Asset_mst();
        int       varassetid                = objAsset.Get_Current_Assetid();
        Asset_PhysicalDrive_mst objphysical = new Asset_PhysicalDrive_mst();

        if (count1 == 0)
        {
            objphysical.Assetid = varassetid;
        }
        else
        {
            objphysical.Assetid = Assetid;
        }

        objphysical.Capacity        = Capacity.InnerText;
        objphysical.Drive_name      = physical_drives.InnerText;
        objphysical.Inventory_date  = inventorydate2;
        objphysical.Manufacturer    = Manufacturer.InnerText;
        objphysical.Product_version = Product_version.InnerText;
        objphysical.Serial_number   = Serial_number.InnerText;
        objphysical.Insert();
    }
示例#15
0
    public void Asset_Logical_Drive_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");

        inventorydate2 = inventory_date.InnerText;
        XmlNode   Drive_letter            = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Drive_letter");
        XmlNode   Drive_type              = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Drive_type");
        XmlNode   File_system_name        = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//File_system_name");
        XmlNode   Free_bytes              = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Free_bytes");
        XmlNode   Total_bytes             = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Total_bytes");
        Asset_mst objAsset                = new Asset_mst();
        int       varassetid              = objAsset.Get_Current_Assetid();
        Asset_LogicalDrive_mst objlogical = new Asset_LogicalDrive_mst();

        if (count1 == 0)
        {
            objlogical.Assetid = varassetid;
        }
        else
        {
            objlogical.Assetid = Assetid;
        }

        objlogical.Drive_letter     = Drive_letter.InnerText;
        objlogical.Drive_type       = Drive_type.InnerText;
        objlogical.File_system_name = File_system_name.InnerText;
        objlogical.Free_bytes       = Free_bytes.InnerText;
        objlogical.Inventory_date   = inventorydate2;
        objlogical.Total_bytes      = Total_bytes.InnerText;
        objlogical.Insert();
    }
示例#16
0
 protected void IncidentToAsset(int userid)
 {
     objOrganization = objOrganization.Get_Organization();
     objUser         = objUser.Get_UserLogin_By_UserName(txtUsername.Text.Trim().ToString().Trim(), objOrganization.Orgid);
     userid          = Convert.ToInt16(objUser.Userid);
     assetid         = Convert.ToInt16(objusertoasset.Get_AssetId_By_UserId(userid));
     objassetmst     = objassetmst.Get_By_id(assetid);
     compname        = objassetmst.Computername;
 }
    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;
                        }
                    }

                }

            }

        }
    }
示例#18
0
    public void Asset_Memory_Info(XmlDocument xmldoc)
    {
        XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");

        inventorydate2 = inventory_date.InnerText;
        XmlNode          physical_mem = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Memory//Physical_memory");
        XmlNode          virtual_mem  = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Memory//Virtual_memory");
        XmlNode          page_file    = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Memory//Page_file_size");
        Asset_mst        objAsset     = new Asset_mst();
        int              varassetid   = objAsset.Get_Current_Assetid();
        Asset_Memory_mst objmemory    = new Asset_Memory_mst();

        if (count1 == 0)
        {
            objmemory.Assetid = varassetid;
        }
        else
        {
            objmemory.Assetid = Assetid;
        }

        objmemory.Inventory_date = inventorydate2;
        objmemory.Page_file      = page_file.InnerText;

        if (Convert.ToDecimal(physical_mem.InnerText) >= 1073741824)
        {
            decimal physicalmem = Convert.ToDecimal(physical_mem.InnerText) / 1073741824;
            //objmemory.Physical_mem = physicalmem.ToString() + " GB";
            objmemory.Physical_mem = String.Format("{0:0.00}", physicalmem) + " GB";
        }
        else
        {
            decimal physicalmem = Convert.ToDecimal(physical_mem.InnerText) / 1048576;
            //objmemory.Physical_mem = physicalmem.ToString() + " MB";
            objmemory.Physical_mem = String.Format("{0:0.00}", physicalmem) + " MB";
        }

        //   objmemory.Physical_mem = physical_mem.InnerText;
        if (Convert.ToDecimal(virtual_mem.InnerText) >= 1073741824)
        {
            decimal virtualmem = Convert.ToDecimal(virtual_mem.InnerText) / 1073741824;
            objmemory.Virtual_mem = String.Format("{0:0.00}", virtualmem) + " GB";
        }
        else
        {
            decimal virtualmem = Convert.ToDecimal(virtual_mem.InnerText) / 1048576;
            objmemory.Virtual_mem = String.Format("{0:0.00}", virtualmem) + " MB";
        }
        //  objmemory.Virtual_mem = virtual_mem.InnerText;
        objmemory.Insert();
    }
    protected void btnAddAsset_Click(object sender, EventArgs e)
    {
        //Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            foreach (GridViewRow gv in grdvwViewAsset.Rows)
            {

                string gvIDs;
                // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
                CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
                // If deleteChkBxItem is Checked then ,mapped Current site to this user
                if (deleteChkBxItem.Checked)
                {
                    ListItem item = new ListItem();
                    int varSiteid;
                    int FlagCheckAsset = 0;
                    // Get the Site Id from variable of Label type declare in GridView of grdvwSite
                    gvIDs = ((Label)gv.FindControl("assetid")).Text.ToString();

                    ObjAsset = ObjAsset.Get_By_id(Convert.ToInt32(gvIDs));
                    item.Text = ObjAsset.Computername;
                    item.Value = Convert.ToString(ObjAsset.Assetid);

                    for (int i = listAsset.Items.Count - 1; i >= 0; i--)
                    {
                        if (Convert.ToInt32(listAsset.Items[i].Value) == ObjAsset.Assetid)
                        {
                            FlagCheckAsset = 1;

                        }

                    }
                    if (FlagCheckAsset == 0)
                    { listAsset.Items.Add(item); }

                }

            }

        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    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;
                        }
                    }
                }
            }
        }
    }
示例#21
0
    public void Asset_OS_Info(XmlDocument xmldoc)
    {
        try
        {
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;

            XmlNode   os_name               = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Name");
            XmlNode   major_version         = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Major_version");
            XmlNode   minor_version         = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Minor_version");
            XmlNode   build_no              = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Build_number");
            XmlNode   add_info              = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Additional_information");
            XmlNode   user_name             = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//User_name");
            XmlNode   reg_to                = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Registered_to");
            XmlNode   reg_org               = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Registered_organization");
            XmlNode   reg_code              = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Registration_code");
            XmlNode   localization          = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Locale");
            XmlNode   product_key           = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Product_key");
            Asset_mst objAsset              = new Asset_mst();
            int       varassetid            = objAsset.Get_Current_Assetid();
            Asset_OperatingSystem_mst objos = new Asset_OperatingSystem_mst();
            objos.Add_info = add_info.InnerText;
            if (count1 == 0)
            {
                objos.Assetid = varassetid;
            }
            else
            {
                objos.Assetid = Assetid;
            }

            objos.Build_no       = build_no.InnerText;
            objos.Inventory_date = inventorydate2;
            objos.Localization   = localization.InnerText;
            objos.Major_version  = major_version.InnerText;
            objos.Minor_version  = minor_version.InnerText;
            objos.Os_name        = os_name.InnerText;
            objos.Product_key    = product_key.InnerText;
            objos.Reg_code       = reg_code.InnerText;
            objos.Reg_org        = reg_org.InnerText;
            objos.Reg_to         = reg_to.InnerText;
            objos.User_name      = user_name.InnerText;
            objos.Insert();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
    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 = "-";

        }
    }
示例#23
0
    protected void btnAddAsset_Click(object sender, EventArgs e)
    {
        //Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            foreach (GridViewRow gv in grdvwViewAsset.Rows)
            {
                string gvIDs;
                // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
                CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
                // If deleteChkBxItem is Checked then ,mapped Current site to this user
                if (deleteChkBxItem.Checked)
                {
                    ListItem item = new ListItem();
                    int      varSiteid;
                    int      FlagCheckAsset = 0;
                    // Get the Site Id from variable of Label type declare in GridView of grdvwSite
                    gvIDs = ((Label)gv.FindControl("assetid")).Text.ToString();


                    ObjAsset   = ObjAsset.Get_By_id(Convert.ToInt32(gvIDs));
                    item.Text  = ObjAsset.Computername;
                    item.Value = Convert.ToString(ObjAsset.Assetid);

                    for (int i = listAsset.Items.Count - 1; i >= 0; i--)
                    {
                        if (Convert.ToInt32(listAsset.Items[i].Value) == ObjAsset.Assetid)
                        {
                            FlagCheckAsset = 1;
                        }
                    }
                    if (FlagCheckAsset == 0)
                    {
                        listAsset.Items.Add(item);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
示例#24
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  = "-";
        }
    }
    protected void btnAddAsset_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow gv in grdvwViewAsset.Rows)
        {

            string gvIDs;
            // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
            CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
            // If deleteChkBxItem is Checked then ,mapped Current site to this user
            if (deleteChkBxItem.Checked)
            {
                ListItem item = new ListItem();
                int varSiteid;
                int FlagCheckAsset=0;
                // Get the Site Id from variable of Label type declare in GridView of grdvwSite
                gvIDs = ((Label)gv.FindControl("assetid")).Text.ToString();

                ObjAsset = ObjAsset.Get_By_id(Convert.ToInt16(gvIDs));
                item.Text = ObjAsset.Computername;
                item.Value = Convert.ToString(ObjAsset.Assetid);

                for (int i = listAsset.Items.Count - 1; i >= 0; i--)
                {
                    if (Convert.ToInt16(listAsset.Items[i].Value) == ObjAsset.Assetid)
                    {
                        FlagCheckAsset = 1;

                    }

                }
                if (FlagCheckAsset==0)
                { listAsset.Items.Add(item); }

            }

        }
    }
示例#26
0
    public void BindGrid()
    {
        DataTable dtTable = new DataTable();

        dtTable = CreateDataTable();
        Asset_mst objAsset = new Asset_mst();
        BLLCollection <Asset_mst> colAsset = new BLLCollection <Asset_mst>();

        colAsset = objAsset.Get_All();
        foreach (Asset_mst obj in colAsset)
        {
            DataRow row;
            row = dtTable.NewRow();
            row["computername"] = Convert.ToString(obj.Computername);
            assetid             = Convert.ToInt32(obj.Assetid);
            Asset_OperatingSystem_mst objos = new Asset_OperatingSystem_mst();
            objos             = objos.Get_By_Assetid(assetid);
            row["osname"]     = Convert.ToString(objos.Os_name);
            row["username"]   = Convert.ToString(objos.User_name);
            row["productkey"] = Convert.ToString(objos.Product_key);
            Asset_ProductInfo_mst objproduct = new Asset_ProductInfo_mst();
            objproduct         = objproduct.Get_By_Assetid(assetid);
            row["productname"] = Convert.ToString(objproduct.Product_name);
            row["productmanu"] = Convert.ToString(objproduct.Product_manufacturer);
            row["serialno"]    = Convert.ToString(objproduct.Serial_number);
            Asset_Processor_mst objprocessor = new Asset_Processor_mst();
            objprocessor         = objprocessor.Get_By_Assetid(assetid);
            row["processorname"] = Convert.ToString(objprocessor.Processor_name);
            Asset_Memory_mst objmemory = new Asset_Memory_mst();
            objmemory             = objmemory.Get_By_Assetid(assetid);
            row["physicalmemory"] = Convert.ToString(objmemory.Physical_mem);
            dtTable.Rows.Add(row);
        }
        dtgrid.DataSource = dtTable;
        dtgrid.DataBind();
    }
    protected void Showchangeinfo()
    {
        Approvalpanal.Visible = true;
        btnApprove.Visible = true;
        btnReject.Visible = true;
        Alreadyapprovedpanal.Visible = false;
        NameValueCollection n = Request.QueryString;

        int changeid = Convert.ToInt16(Request.QueryString[0]);
        //lblchangeid.Text = changeid.ToString();
        ObjChange = ObjChange.Get_By_id(changeid);
        lblchangeid.Text = ObjChange.Changeid.ToString();
        lbltitle.Text = ObjChange.Title;
        lbldescription.Text = ObjChange.Description;
        //lblDateDisp.Text = ObjChange.Createdtime.ToString();
        int requesterid = Convert.ToInt16(ObjChange.Requestedby);

        //lblTitle.Text = ObjChange.Title.ToString();

        //lblDescription.Text = ObjChange.Description.ToString();

        lblserviceeffected.Text = "Email";
        int chantypeid = Convert.ToInt16(ObjChange.Changetype);
        ObjChangeType = ObjChangeType.Get_By_id(chantypeid);
        if (chantypeid != 0)
        {
            lblchangetype.Text = ObjChangeType.Changetypename.ToString();
        }
        int changestatus = Convert.ToInt16(ObjChange.Statusid);
        Objchangestatus = Objchangestatus.Get_By_id(changestatus);
        if (changestatus != 0)
        {
            lblStatus.Text = Objchangestatus.Statusname;
        }
        int priorityid = Convert.ToInt16(ObjChange.Priority);
        ObjPriority = ObjPriority.Get_By_id(priorityid);
        if (priorityid != 0)
        {
            lblpriority.Text = ObjPriority.Name.ToString();

        }
        else
        {
            lblpriority.Text = "";

        }

        int category = Convert.ToInt16(ObjChange.Categoryid);
        ObjCategory = ObjCategory.Get_By_id(category);
        if (category != 0)
        {
            lblcategory.Text = ObjCategory.CategoryName.ToString();

        }
        else
        {
            lblcategory.Text = "";

        }

        int subcategory = Convert.ToInt16(ObjChange.Subcategoryid);
        Objsubcategory = Objsubcategory.Get_By_id(subcategory);
        if (subcategory != 0)
        {
            lblsubcategory.Text = Objsubcategory.Subcategoryname.ToString();

        }
        else
        {
            lblsubcategory.Text = "";

        }

        int creator = Convert.ToInt16(ObjChange.CreatedByID);
        ObjUser = ObjUser.Get_By_id(creator);
        lblCreatedby.Text = ObjUser.Username.ToString();
        lblCreatedDate.Text = ObjChange.Createdtime.ToString();
        int techid = Convert.ToInt16(ObjChange.Technician);
        ObjUser = ObjUser.Get_By_id(techid);

        if (techid != 0)
        {
            lbltechid.Text = ObjUser.Username.ToString();

        }
        else
        {
            lbltechid.Text = "";

        }
        colassetincludeinchange = objincludeasset.Get_All_IncludeAssetinchange(changeid);
        BLLCollection<Configuration_mst> colasset = new BLLCollection<Configuration_mst>();
        Configuration_mst ObjAsset = new Configuration_mst();

        foreach (IncludedAssetinchange obj in colassetincludeinchange)
        {
            ObjAsset = ObjAsset.Get_By_id(obj.Assetid);
            colasset.Add(ObjAsset);

        }
        lstAsset.DataTextField = "Serialno";
        lstAsset.DataValueField = "assetid";
        lstAsset.DataSource = colasset;
        lstAsset.DataBind();
    }
    protected void Showchangeinfo()
    {
        Approvalpanal.Visible        = true;
        btnApprove.Visible           = true;
        btnReject.Visible            = true;
        Alreadyapprovedpanal.Visible = false;
        NameValueCollection n = Request.QueryString;

        int changeid = Convert.ToInt32(Request.QueryString[0]);

        //lblchangeid.Text = changeid.ToString();
        ObjChange           = ObjChange.Get_By_id(changeid);
        lblchangeid.Text    = ObjChange.Changeid.ToString();
        lbltitle.Text       = ObjChange.Title;
        lbldescription.Text = ObjChange.Description;
        //lblDateDisp.Text = ObjChange.Createdtime.ToString();
        int requesterid = Convert.ToInt32(ObjChange.Requestedby);



        //lblTitle.Text = ObjChange.Title.ToString();

        //lblDescription.Text = ObjChange.Description.ToString();

        lblserviceeffected.Text = "Email";
        int chantypeid = Convert.ToInt32(ObjChange.Changetype);

        ObjChangeType = ObjChangeType.Get_By_id(chantypeid);
        if (chantypeid != 0)
        {
            lblchangetype.Text = ObjChangeType.Changetypename.ToString();
        }
        int changestatus = Convert.ToInt32(ObjChange.Statusid);

        Objchangestatus = Objchangestatus.Get_By_id(changestatus);
        if (changestatus != 0)
        {
            lblStatus.Text = Objchangestatus.Statusname;
        }
        int priorityid = Convert.ToInt32(ObjChange.Priority);

        ObjPriority = ObjPriority.Get_By_id(priorityid);
        if (priorityid != 0)
        {
            lblpriority.Text = ObjPriority.Name.ToString();
        }
        else
        {
            lblpriority.Text = "";
        }

        int category = Convert.ToInt32(ObjChange.Categoryid);

        ObjCategory = ObjCategory.Get_By_id(category);
        if (category != 0)
        {
            lblcategory.Text = ObjCategory.CategoryName.ToString();
        }
        else
        {
            lblcategory.Text = "";
        }


        int subcategory = Convert.ToInt32(ObjChange.Subcategoryid);

        Objsubcategory = Objsubcategory.Get_By_id(subcategory);
        if (subcategory != 0)
        {
            lblsubcategory.Text = Objsubcategory.Subcategoryname.ToString();
        }
        else
        {
            lblsubcategory.Text = "";
        }

        int creator = Convert.ToInt32(ObjChange.CreatedByID);

        ObjUser             = ObjUser.Get_By_id(creator);
        lblCreatedby.Text   = ObjUser.Username.ToString();
        lblCreatedDate.Text = ObjChange.Createdtime.ToString();
        int techid = Convert.ToInt32(ObjChange.Technician);

        ObjUser = ObjUser.Get_By_id(techid);

        if (techid != 0)
        {
            lbltechid.Text = ObjUser.Username.ToString();
        }
        else
        {
            lbltechid.Text = "";
        }
        colassetincludeinchange = objincludeasset.Get_All_IncludeAssetinchange(changeid);
        BLLCollection <Configuration_mst> colasset = new BLLCollection <Configuration_mst>();
        Configuration_mst ObjAsset = new Configuration_mst();

        foreach (IncludedAssetinchange obj in colassetincludeinchange)
        {
            ObjAsset = ObjAsset.Get_By_id(obj.Assetid);
            colasset.Add(ObjAsset);
        }
        lstAsset.DataTextField  = "Serialno";
        lstAsset.DataValueField = "assetid";
        lstAsset.DataSource     = colasset;
        lstAsset.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /////Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            Lblstatusupdatemsg.Text = "";
            this.ClientScript.GetPostBackEventReference(this, "arg");
            /////////////////////////////////change done by meenakshi

                     int flag = Convert.ToInt32(Session["flag"]);
                     if (flag == 1)
                     {
                         txtExternalTicket.Text = (string)Session["compname"];
                         Session["flag"] = "0";
                     }

            //////////////////////////////////end
            int incidentid = Convert.ToInt32(Request.QueryString[0]);
            assetid = Convert.ToInt32(objincitiasset.Get_AssetId_By_incidentId(incidentid));

            if (assetid != 0)//Incase of no asset assign to user.
            {
                assetid = Convert.ToInt32(objincitiasset.Get_AssetId_By_incidentId(incidentid));
                objaseetmst = objaseetmst.Get_By_id(assetid);
                string compname = objaseetmst.Computername;
                XmlDocument xmldoc = new XmlDocument();
                DirectoryInfo di = new DirectoryInfo("C://Asset//Data");
                FileInfo[] fi = di.GetFiles();
                foreach (FileInfo K in fi)
                {
                    string[] fname = K.Name.Split(new char[] { '.' });

                    if (fname[0].ToString() == compname)
                    {
                        string path = "C:\\Asset\\Data\\" + compname + ".xml";
                        String filestr = File.ReadAllText(path);
                        xmldoc.LoadXml(filestr);
                        // xmldoc.Load(path);
                        DisplayComputerDetails(xmldoc);
                    }
                }
                // string path = "C:\\Asset\\Data\\" + compname + ".xml";
                //xmldoc.Load(path);

            }

            ///////////////////////changed///////////////////////////

            ///////////////////////////////////////////////////////////
            if (!IsPostBack)
            {
                LnkAttachment.Visible = false;
                lbltimespentonDisp.Visible = false;
                lbltimespentonreq.Text = "";
                pan1.Visible = true;
                pan2.Visible = false;
                UpdatePanel1();
                PanelShowNotes();
                /////////////////////////////////////added by lalit joshi ///////////////////////////////
                DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/FileAttach"));
                FileInfo[] fileinfo = dir.GetFiles();

                foreach (FileInfo f in fileinfo)
                {
                    string[] str = f.Name.Split(new char[] { '.' });
                    if (str[0] == Convert.ToString(incidentid))
                    {
                        LnkAttachment.Visible = true;
                    }

                }
                ////////////////////////////////////////////////////////////////////////////////////////////////
            }

            HistoryUpdatePanel();
            string CMDBUpdate = "";
            if (Session["CMDBUpdate"] != null)
            {
                CMDBUpdate = Session["CMDBUpdate"].ToString();
            }

            if (CMDBUpdate == "true")
            {
                pan1.Visible = false;
                pan2.Visible = true;
                UpdatePanel2();
                lnkEdit.Visible = false;
                btnCancel.Visible = true;
                btnUpdate.Visible = true;
                HistoryUpdatePanel();
                drpStatus.SelectedValue = Session["drpStatus.SelectedValue"].ToString();
                drpMode.SelectedValue = Session["drpMode.SelectedValue"].ToString();
                drpCategory.SelectedValue = Session["drpCategory.SelectedValue"].ToString();
                drpSubcategory.SelectedValue = Session["drpSubcategory.SelectedValue"].ToString();
                drpAMCCall.SelectedValue = Session["drpAMCCall.SelectedValue"].ToString();
                Session["CMDBUpdate"] = "false";
                FunctionUpdate();
            }
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    public void Asset_Processor_Info(XmlDocument xmldoc)
    {
        try
        {
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;
            XmlNode Family = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Family");
            XmlNode Manufacturer = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Manufacturer");
            XmlNode Max_speed = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Max_speed");
            XmlNode Model = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Model");
            XmlNode processors = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Processor");
            XmlNode Speed = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Speed");
            XmlNode Stepping = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Processors//Stepping");
            Asset_mst objAsset = new Asset_mst();
            int varassetid = objAsset.Get_Current_Assetid();
            Asset_Processor_mst objprocessor = new Asset_Processor_mst();
            if (count1 == 0)
            {
                objprocessor.Assetid = varassetid;
            }
            else
            {
                objprocessor.Assetid = Assetid;
            }

            objprocessor.Family = Family.InnerText;
            objprocessor.Inventory_date = inventorydate2;
            objprocessor.Manufacturer = Manufacturer.InnerText;
            objprocessor.Max_speed = Max_speed.InnerText;
            objprocessor.Model = Model.InnerText;
            objprocessor.Processor_name = processors.InnerText;
            objprocessor.Speed = Speed.InnerText;
            objprocessor.Stepping = Stepping.InnerText;
            objprocessor.Insert();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
 public int Insert1_Asset_mst(Asset_mst objAsset)
 {
     return (int)ExecuteNonQuery(Sp_Asset_Insert1, new object[] { objAsset.Domain, objAsset.Createdatetime, objAsset.Computername, objAsset.TagNo, objAsset.PONo, objAsset.AssetOwner, objAsset.location, objAsset.IsInStock, objAsset.CompanyCode, objAsset.PurchaseDate, objAsset.AssetCategory, objAsset.Remarks });
 }
 /// <summary>
 /// //////Create by Vishal 02-06-2012 
 /// </summary>
 /// <param name="objAsset"></param>
 /// <returns></returns>
 public int UpdateDeleteFlag_Asset_id(Asset_mst objAsset)
 {
     return (int)ExecuteNonQuery(UpdateDeleteFlag_Asset, new object[] { objAsset.Assetid });
 }
    public void Asset_Software(XmlDocument xmldoc)
    {
        try
        {
            int count;
            string compname1, domain1;
            XmlNode compname = xmldoc.DocumentElement.SelectSingleNode("//Computer//Computer_name");
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;
            XmlNode domain = xmldoc.DocumentElement.SelectSingleNode("//Computer//Domain");

            compname1 = compname.InnerText;
            domain1 = domain.InnerText;

            Asset_mst objAsset = new Asset_mst();
            int varassetid = objAsset.Get_Current_Assetid();

            if (count1 == 0)
            {
                objsoftwaremst.Assetid = varassetid;
            }
            else
            {
                objsoftwaremst.Assetid = Assetid;
            }
            softwares = Softwares_info(xmldoc);

            for (int k = 0; k < flagsoftcount; k++)
            {

                software_name = softwares[k, 0];
                software_manufacturer = softwares[k, 1];
                install_directory = softwares[k, 2];
                software_version = softwares[k, 3];
                software_version_major = softwares[k, 4];
                software_version_minor = softwares[k, 5];
                installed_on = softwares[k, 6];
                software_registered_to = softwares[k, 7];
                software_registration_code = softwares[k, 8];
                software_registered_organization = softwares[k, 9];
                software_product_key = softwares[k, 10];
                bool check_date = CheckDate(installed_on);
                if (!check_date)
                {
                    installed_on = null;

                }
                objsoftwaremst.Inventorydate = inventorydate2;
                objsoftwaremst.Computername = compname1;
                objsoftwaremst.Domainname = domain1;
                objsoftwaremst.Software_name = software_name.Replace("?"," ").Trim();
                objsoftwaremst.Software_manufacturer = software_manufacturer;
                objsoftwaremst.Install_directory = install_directory;
                objsoftwaremst.Software_version = software_version;
                objsoftwaremst.Software_version_major = software_version_major;
                objsoftwaremst.Software_version_minor = software_version_minor;
                objsoftwaremst.Software_registered_to = software_registered_to;
                objsoftwaremst.Software_registration_code = software_registration_code;
                objsoftwaremst.Software_registered_organization = software_registered_organization;
                objsoftwaremst.Software_product_key = software_product_key;
                objsoftwaremst.Installed_on = installed_on;
                objsoftwaremst.Insert();
            }

            // objnetwork.Insert();

        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
示例#34
0
    //////////////////////////////////////////////////////////////////meenakshi
    //protected void btnMapped_Click(object sender, EventArgs e)
    //{/////Add Exception handilng try catch change by vishal 21-05-2012
    //    try
    //    {
    //        //lblErrorMsg.Text = "";
    //        int flag = 0;
    //        int tempuser;
    //        tempuser = Convert.ToInt32(Session["tempuser"]);

    //        foreach (GridViewRow gv in grdvwViewAsset.Rows)
    //        {
    //            string gvIDs;
    //            RadioButton selectonebutton = (RadioButton)gv.FindControl("selectone");
    //            if (selectonebutton.Checked)
    //            {
    //                flag = 1;
    //                int assetid;
    //                gvIDs = ((Label)gv.FindControl("lblAssetID")).Text.ToString();
    //                assetid = Convert.ToInt32(gvIDs);
    //                string Username = lblusername.Text.ToString().Trim();
    //                objUser = objUser.Get_UserLogin_By_UserName_Like(Username);
    //                userid = objUser.Userid;
    //                if (lblusername.Text == "")
    //                {

    //                    //lblErrorMsg.Text = "Enter the user name for mapped a particular Asset";
    //                    break;
    //                }

    //                else if (tempuser == 1)
    //                {
    //                    assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid);
    //                    int tempuser1 = 0;
    //                    if (assetcount == 0)
    //                    {
    //                        int flag1 = 1;
    //                        ObjAsset = ObjAsset.Get_By_id(assetid);
    //                        string compname = ObjAsset.Computername.ToString();
    //                        string username = lblusername.Text.ToString();
    //                        Session["compname"] = compname;
    //                        Session["flag"] = flag1;
    //                        Session["username"] = username;
    //                        Session["assetid"] = assetid;
    //                        Session["userid"] = userid;
    //                        tempuser1 = 1;
    //                        Session["tempuser1"] = tempuser1;
    //                        Session["flag1"] = flag1;
    //                        break;
    //                    }
    //                    else
    //                    {
    //                        //lblErrorMsg.Text = "Asset already mapped";
    //                        break;
    //                    }
    //                }
    //                else if (userid == 0)
    //                {
    //                    //lblErrorMsg.Text = "User Name doen not exist";
    //                    break;
    //                }
    //                else
    //                {
    //                    assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid);
    //                    usercount = objusertoasset.Get_UserId_From_UserToAssetMap(userid);
    //                    //  objcontactinfo = objcontactinfo.Get_By_id(userid);
    //                    objUser = objUser.Get_By_id(userid);
    //                    if (assetcount == 0)
    //                    {
    //                        if (usercount == 0)
    //                        {
    //                            int flag1 = 1;
    //                            objusertoasset.Insert(userid, assetid, objUser.City, objUser.Company);
    //                            //lblErrorMsg.Text = "Mapped Succussfully";
    //                            ObjAsset = ObjAsset.Get_By_id(assetid);
    //                            string compname = ObjAsset.Computername.ToString();
    //                            string username = lblusername.Text.ToString();
    //                            Session["compname"] = compname;
    //                            Session["flag"] = flag1;
    //                            Session["username"] = username;
    //                            Session["assetid"] = assetid;
    //                            Session["userid"] = userid;
    //                            Session["flag1"] = flag1;
    //                            break;

    //                        }
    //                        else  //Update Asset id from UserToAsset table.
    //                        {
    //                            int flag1 = 1;
    //                            int oldassetid = Convert.ToInt32(Session["assignassetid"]);
    //                            objusertoasset.Update_Assetid(oldassetid, assetid, objUser.City, objUser.Company);
    //                            ObjAsset = ObjAsset.Get_By_id(assetid);
    //                            string compname = ObjAsset.Computername.ToString();
    //                            string username = lblusername.Text.ToString();
    //                            Session["compname"] = compname;
    //                            Session["flag"] = flag1;
    //                            Session["username"] = username;
    //                            Session["assetid"] = assetid;
    //                            Session["userid"] = userid;
    //                            Session["flag1"] = flag1;
    //                            break;
    //                        }
    //                    }
    //                    else
    //                    {
    //                        //lblErrorMsg.Text = "Asset already mapped";
    //                        break;
    //                    }
    //                }
    //            }

    //        }
    //        if (flag == 0)
    //        {
    //            //lblErrorMsg.Text = "Select Asset for mapping";
    //        }

    //        string myScript;
    //        myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>";
    //        Page.RegisterClientScriptBlock("MyScript", myScript);
    //    }
    //    catch (Exception ex)

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



    protected void btnSelect_Click(object sender, EventArgs e)
    {
        try
        {
            int flag = 0;
            foreach (GridViewRow gv in grdvwViewAsset.Rows)
            {
                string      gvIDs;
                RadioButton selectonebutton = (RadioButton)gv.FindControl("selectone");
                if (selectonebutton.Checked)
                {
                    flag = 1;
                    int assetid;
                    gvIDs            = ((Label)gv.FindControl("lblAssetID")).Text.ToString();
                    assetid          = Convert.ToInt32(gvIDs);
                    Session["assId"] = assetid;
                    int incidentid = Convert.ToInt32(Session["incidentid"]);

                    colin = objintoass.Get_All();
                    //objintoass.incidentid=Convert.ToInt32(objintoass.Get_incidentId_From_incidentToAssetMap(incidentid));
                    int Count = Convert.ToInt32(objintoass.Get_incidentId_From_incidentToAssetMap(incidentid));
                    IncidentToAssetMapping objincass = new IncidentToAssetMapping();
                    if (incidentid != 0 && assetid != 0)
                    {
                        for (int i = 0; i < Count; i++)
                        {
                            string        sQuery = ("update IncidentToAssetMapping set assetid='" + assetid + "' where incidentid='" + incidentid + "'");
                            string        constr = System.Configuration.ConfigurationManager.ConnectionStrings["CSM_DB"].ToString();
                            SqlConnection sc     = new SqlConnection(constr);
                            sc.Open();
                            SqlCommand    cmd = new SqlCommand(sQuery, sc);
                            SqlDataReader dr  = cmd.ExecuteReader();
                            dr.Read();
                            //ObjAsset = ObjAsset.Get_By_id(assetid);
                            //string compname = ObjAsset.Computername.ToString();
                            //Session["compname"] = compname;
                            //Session["flag"] = flag;
                        }

                        if (Count == 0)
                        {
                            objincass.Insert(incidentid, assetid);
                            //ObjAsset = ObjAsset.Get_By_id(assetid);
                            //string compname = ObjAsset.Computername.ToString();
                            //Session["compname"] = compname;
                            //Session["flag"] = flag;
                            break;
                        }
                    }
                    ObjAsset = ObjAsset.Get_By_id(assetid);
                    string compname = ObjAsset.Computername.ToString();
                    Session["compname"] = compname;
                    Session["flag"]     = flag;
                }
            }
            string myScript;
            myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
 protected void IncidentToAsset(int userid)
 {
     objOrganization = objOrganization.Get_Organization();
     objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid);
     userid = Convert.ToInt32(objUser.Userid);
     assetid = Convert.ToInt32(objusertoasset.Get_AssetId_By_UserId(userid));
     objassetmst = objassetmst.Get_By_id(assetid);
     compname = objassetmst.Computername;
 }
    protected void DisplayComputerDetails(XmlDocument xmldoc)
    {
        //Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            XmlNode compname = xmldoc.DocumentElement.SelectSingleNode("//Computer//Computer_name");
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            XmlNode domain = xmldoc.DocumentElement.SelectSingleNode("//Computer//Domain");

            //added by lalit
            //XmlNode TagNo = xmldoc.DocumentElement.SelectSingleNode("//Computer//TagNo");
            //XmlNode PONo = xmldoc.DocumentElement.SelectSingleNode("//Computer//PONo");
            //XmlNode AssetOwner = xmldoc.DocumentElement.SelectSingleNode("//Computer//AssetOwner");
            //XmlNode IsInStock = xmldoc.DocumentElement.SelectSingleNode("//Computer//IsInStock");
            //end

            ///add by Vishal 16-05-2012
            /////Get_AssetGet_By_id
            objasset = objasset.Get_By_id(Convert.ToInt32(lblAssetId.Text));
            string strTagNo = objasset.TagNo;
            string strPoNo = objasset.PONo;
            string strAssetOwner = objasset.AssetOwner;
            ///end///
            ///change done by meenakshi
            //string strCompanyCode = objasset.CompanyCode;
            //string strPurchaseDate = objasset.PurchaseDate;
            //string strAssetCategory = objasset.AssetCategory;
            //string strRemarks = objasset.Remarks;
            ///end///
            lblcomputername.Text = compname.InnerText;
            ///Comment by Vishal 17-05-2012
            // lblassetname.Text = compname.InnerText + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            lblassetname.Text = compname.InnerText + "";
            lblassetid1.Text = lblAssetId.Text;
            lblcreateddate.Text = inventory_date.InnerText;
            ///Comment by Vishal 17-05-2012
            //lbllastinventory.Text = inventory_date.InnerText + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            lbllastinventory.Text = inventory_date.InnerText + "";
            lbldomain.Text = domain.InnerText;
            //if (TagNo != null)
            //{
            //    LblTageno.Text = TagNo.InnerText;
            //}
            //if (PONo != null)
            //{
            //    LblPONo.Text = PONo.InnerText;
            //}
            //if (AssetOwner != null)
            //{
            //    LblAssetOwner.Text = AssetOwner.InnerText;
            //}

            //else if (AssetOwner == null)
            //{
            //    objusertoasset = objusertoasset.Get_By_id(objasset.Assetid);
            //    if(objusertoasset!=null)
            //    {
            //       LblAssetOwner.Text = objusertoasset.AssetCompanyName;
            //    }
            //}
            //if (IsInStock != null)
            //{
            //    lblStock.Text = IsInStock.InnerText;
            //}
            ///add by Vishal

            if (strTagNo != "")
            {
                LblTageno.Text = strTagNo;
            }
            if (strPoNo != "")
            {
                LblPONo.Text = strPoNo;
            }
            if (strAssetOwner != "")
            {
                LblAssetOwner.Text = strAssetOwner;
            }

            else if (strAssetOwner == "")
            {
                objusertoasset = objusertoasset.Get_By_id(objasset.Assetid);
                if (objusertoasset != null)
                {
                    LblAssetOwner.Text = objusertoasset.AssetCompanyName;
                }
            }
            ///
            //if (IsInStock != null)
            //{
            //    lblStock.Text = IsInStock.InnerText;
            //}
            objasset = objasset.Get_Asset_By_Computername(lblcomputername.Text);
            if (objusertoasset != null)
            {
                LblAssetLocation.Text = objusertoasset.AssetLocation;
            }
            //add by meenakshi 22 june
            /////////////////////////////////////
            //if (strCompanyCode != "")
            //{
            //    LblCompanyCode.Text = strCompanyCode;
            //}
            //if (strPurchaseDate != "")
            //{
            //    LblPurchaseDate.Text = strCompanyCode;
            //}
            //if (strAssetCategory != "")
            //{
            //    LblAssetCategory.Text = strCompanyCode;
            //}
            //if (strRemarks != "")
            //{
            //    LblRemarks.Text = strCompanyCode;
            //}//////////////////////////////

            //end

        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    public void Asset_Logical_Drive_Info(XmlDocument xmldoc)
    {
        try
        {
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;
            XmlNode Drive_letter = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Drive_letter");
            XmlNode Drive_type = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Drive_type");
            XmlNode File_system_name = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//File_system_name");
            XmlNode Free_bytes = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Free_bytes");
            XmlNode Total_bytes = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Logical_drives//Total_bytes");
            Asset_mst objAsset = new Asset_mst();
            int varassetid = objAsset.Get_Current_Assetid();
            Asset_LogicalDrive_mst objlogical = new Asset_LogicalDrive_mst();
            if (count1 == 0)
            {
                objlogical.Assetid = varassetid;
            }
            else
            {
                objlogical.Assetid = Assetid;
            }

            objlogical.Drive_letter = Drive_letter.InnerText;
            objlogical.Drive_type = Drive_type.InnerText;
            objlogical.File_system_name = File_system_name.InnerText;
            objlogical.Free_bytes = Free_bytes.InnerText;
            objlogical.Inventory_date = inventorydate2;
            objlogical.Total_bytes = Total_bytes.InnerText;
            objlogical.Insert();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
    public void Asset_OS_Info(XmlDocument xmldoc)
    {
        try
        {
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;

            XmlNode os_name = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Name");
            XmlNode major_version = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Major_version");
            XmlNode minor_version = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Minor_version");
            XmlNode build_no = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Build_number");
            XmlNode add_info = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Additional_information");
            XmlNode user_name = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//User_name");
            XmlNode reg_to = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Registered_to");
            XmlNode reg_org = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Registered_organization");
            XmlNode reg_code = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Registration_code");
            XmlNode localization = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Locale");
            XmlNode product_key = xmldoc.DocumentElement.SelectSingleNode("//Computer//General_info//Operating_system//Product_key");
            Asset_mst objAsset = new Asset_mst();
            int varassetid = objAsset.Get_Current_Assetid();
            Asset_OperatingSystem_mst objos = new Asset_OperatingSystem_mst();
            objos.Add_info = add_info.InnerText;
            if (count1 == 0)
            {
                objos.Assetid = varassetid;
            }
            else
            {
                objos.Assetid = Assetid;
            }

            objos.Build_no = build_no.InnerText;
            objos.Inventory_date = inventorydate2;
            objos.Localization = localization.InnerText;
            objos.Major_version = major_version.InnerText;
            objos.Minor_version = minor_version.InnerText;
            objos.Os_name = os_name.InnerText;
            objos.Product_key = product_key.InnerText;
            objos.Reg_code = reg_code.InnerText;
            objos.Reg_org = reg_org.InnerText;
            objos.Reg_to = reg_to.InnerText;
            objos.User_name = user_name.InnerText;
            objos.Insert();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
    protected void BindListBox()
    {
        drpCategory.SelectedValue = Session["Categoryid"].ToString();
        drpSubcategory.SelectedValue = Session["Subcategoryid"].ToString();
        drpTechnician.SelectedValue = Session["Technician"].ToString();
        txtTitle.Text = Session["Title"].ToString();
        drpchangetype.SelectedValue = Session["Changetype"].ToString();

        Asset_mst ObjAsset = new Asset_mst();
        BLLCollection<Asset_mst> col = new BLLCollection<Asset_mst>();
        string varAsset = Session["AssetContract"].ToString();
        string[] arrAsset = varAsset.Split(',');
        int FlagCount = arrAsset.Length;
        for (int i = 0; i < FlagCount; i++)
        {
            if (arrAsset[i] != "," && arrAsset[i] != "")
            {
                Asset_mst obj = new Asset_mst();
                obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString()));
                col.Add(obj);
            }

        }
        ListAsset.DataTextField = "computerName";
        ListAsset.DataValueField = "assetid";
        ListAsset.DataSource = col;
        ListAsset.DataBind();
        for (int i = ListAsset.Items.Count - 1; i >= 0; i--)
        {
            ListAsset.Items[i].Selected = true;

        }
        Session["AssetContract"] = "";
    }
 ////////end 02-06-2012
 /////////////Create by Vishal 04-06-2012
 public int Update_Asset_mst_Tag_PO_IsInStockBy_id(Asset_mst objAsset)
 {
     return (int)ExecuteNonQuery(Sp_Asset_Tag_ISINSTOCK_Update, new object[] { objAsset.Assetid, objAsset.TagNo, objAsset.PONo, objAsset.AssetOwner, objAsset.location, objAsset.CompanyCode, objAsset.PurchaseDate, objAsset.AssetCategory, objAsset.Remarks });
 }
    protected void btnMapped_Click(object sender, EventArgs e)
    {
        /////Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            //lblErrorMsg.Text = "";
            int flag = 0;
            int tempuser;
            tempuser = Convert.ToInt32(Session["tempuser"]);

            foreach (GridViewRow gv in grdvwViewAsset.Rows)
            {
                string gvIDs;
                RadioButton selectonebutton = (RadioButton)gv.FindControl("selectone");
                if (selectonebutton.Checked)
                {
                    flag = 1;
                    int assetid;
                    gvIDs = ((Label)gv.FindControl("lblAssetID")).Text.ToString();
                    assetid = Convert.ToInt32(gvIDs);
                    string Username = lblusername.Text.ToString().Trim();
                    objUser = objUser.Get_UserLogin_By_UserName_Like(Username);
                    userid = objUser.Userid;
                    if (lblusername.Text == "")
                    {

                        //lblErrorMsg.Text = "Enter the user name for mapped a particular Asset";
                        break;
                    }

                    else if (tempuser == 1)
                    {
                        assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid);
                        int tempuser1 = 0;
                        if (assetcount == 0)
                        {
                            int flag1 = 1;
                            ObjAsset = ObjAsset.Get_By_id(assetid);
                            string compname = ObjAsset.Computername.ToString();
                            string username = lblusername.Text.ToString();
                            Session["compname"] = compname;
                            Session["flag"] = flag1;
                            Session["username"] = username;
                            Session["assetid"] = assetid;
                            Session["userid"] = userid;
                            tempuser1 = 1;
                            Session["tempuser1"] = tempuser1;
                            Session["flag1"] = flag1;
                            break;
                        }
                        else
                        {
                            //lblErrorMsg.Text = "Asset already mapped";
                            break;
                        }
                    }
                    else if (userid == 0)
                    {
                        //lblErrorMsg.Text = "User Name doen not exist";
                        break;
                    }
                    else
                    {
                        assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid);
                        usercount = objusertoasset.Get_UserId_From_UserToAssetMap(userid);
                        //  objcontactinfo = objcontactinfo.Get_By_id(userid);
                        objUser = objUser.Get_By_id(userid);
                        if (assetcount == 0)
                        {
                            if (usercount == 0)
                            {
                                int flag1 = 1;
                                objusertoasset.Insert(userid, assetid, objUser.City, objUser.Company);
                                //lblErrorMsg.Text = "Mapped Succussfully";
                                ObjAsset = ObjAsset.Get_By_id(assetid);
                                string compname = ObjAsset.Computername.ToString();
                                string username = lblusername.Text.ToString();
                                Session["compname"] = compname;
                                Session["flag"] = flag1;
                                Session["username"] = username;
                                Session["assetid"] = assetid;
                                Session["userid"] = userid;
                                Session["flag1"] = flag1;
                                break;

                            }
                            else  //Update Asset id from UserToAsset table.
                            {
                                int flag1 = 1;
                                int oldassetid = Convert.ToInt32(Session["assignassetid"]);
                                objusertoasset.Update_Assetid(oldassetid, assetid, objUser.City, objUser.Company);
                                ObjAsset = ObjAsset.Get_By_id(assetid);
                                string compname = ObjAsset.Computername.ToString();
                                string username = lblusername.Text.ToString();
                                Session["compname"] = compname;
                                Session["flag"] = flag1;
                                Session["username"] = username;
                                Session["assetid"] = assetid;
                                Session["userid"] = userid;
                                Session["flag1"] = flag1;
                                break;
                            }
                        }
                        else
                        {
                            //lblErrorMsg.Text = "Asset already mapped";
                            break;
                        }
                    }
                }

            }
            if (flag == 0)
            {
                //lblErrorMsg.Text = "Select Asset for mapping";
            }

            string myScript;
            myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
 public void Asset_Product_Info(XmlDocument xmldoc)
 {
     try
     {
         XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
         inventorydate2 = inventory_date.InnerText;
         XmlNode product_name = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//Name");
         XmlNode product_manufacturer = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//Manufacturer");
         XmlNode Serial_number = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//Serial_number");
         XmlNode UUID = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//UUID");
         XmlNode SKU_number = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Product_details//SKU_number");
         Asset_mst objAsset = new Asset_mst();
         int varassetid = objAsset.Get_Current_Assetid();
         Asset_ProductInfo_mst objprodinfo = new Asset_ProductInfo_mst();
         if (count1 == 0)
         {
             objprodinfo.Assetid = varassetid;
         }
         else
         {
             objprodinfo.Assetid = Assetid;
         }
         objprodinfo.Inventory_date = inventorydate2;
         objprodinfo.Product_manufacturer = product_manufacturer.InnerText;
         objprodinfo.Product_name = product_name.InnerText;
         objprodinfo.Serial_number = Serial_number.InnerText;
         objprodinfo.Sku_no = SKU_number.InnerText;
         objprodinfo.Uuid = UUID.InnerText;
         objprodinfo.Insert();
     }
     catch (Exception ex)
     {
         ex.ToString();
     }
 }
    protected void BindListBox()
    {
        int contractid = Convert.ToInt32(Request.QueryString[0]);
        Asset_mst ObjAsset = new Asset_mst();
        BLLCollection<Asset_mst> col = new BLLCollection<Asset_mst>();
        string varAsset = Session["AssetContract"].ToString();
        string[] arrAsset = varAsset.Split(',');
        int FlagCount = arrAsset.Length;
        for (int i = 0; i < FlagCount; i++)
        {
            if (arrAsset[i] != "," && arrAsset[i] != "")
            {
                ContractToAssetMapping objCoAsset = new ContractToAssetMapping();
                ListItem item = new ListItem();
                int flagcount;
                Asset_mst obj = new Asset_mst();
                obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString()));
                flagcount = objCoAsset.Get_by_Contractid_Assetid(contractid, Convert.ToInt32(arrAsset[i].ToString()));
                if (flagcount == 0)
                {
                    item.Text = obj.Computername;
                    item.Value = Convert.ToString(obj.Assetid);
                    ListAsset.Items.Add(item);

                }
            }

        }
    }
    public void Asset_Software(XmlDocument xmldoc)
    {
        try
        {
            int     count;
            string  compname1, domain1;
            XmlNode compname       = xmldoc.DocumentElement.SelectSingleNode("//Computer//Computer_name");
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;
            XmlNode domain = xmldoc.DocumentElement.SelectSingleNode("//Computer//Domain");

            compname1 = compname.InnerText;
            domain1   = domain.InnerText;

            Asset_mst objAsset   = new Asset_mst();
            int       varassetid = objAsset.Get_Current_Assetid();

            if (count1 == 0)
            {
                objsoftwaremst.Assetid = varassetid;
            }
            else
            {
                objsoftwaremst.Assetid = Assetid;
            }
            softwares = Softwares_info(xmldoc);

            for (int k = 0; k < flagsoftcount; k++)
            {
                software_name                    = softwares[k, 0];
                software_manufacturer            = softwares[k, 1];
                install_directory                = softwares[k, 2];
                software_version                 = softwares[k, 3];
                software_version_major           = softwares[k, 4];
                software_version_minor           = softwares[k, 5];
                installed_on                     = softwares[k, 6];
                software_registered_to           = softwares[k, 7];
                software_registration_code       = softwares[k, 8];
                software_registered_organization = softwares[k, 9];
                software_product_key             = softwares[k, 10];
                bool check_date = CheckDate(installed_on);
                if (!check_date)
                {
                    installed_on = null;
                }
                objsoftwaremst.Inventorydate                    = inventorydate2;
                objsoftwaremst.Computername                     = compname1;
                objsoftwaremst.Domainname                       = domain1;
                objsoftwaremst.Software_name                    = software_name.Replace("?", " ").Trim();
                objsoftwaremst.Software_manufacturer            = software_manufacturer;
                objsoftwaremst.Install_directory                = install_directory;
                objsoftwaremst.Software_version                 = software_version;
                objsoftwaremst.Software_version_major           = software_version_major;
                objsoftwaremst.Software_version_minor           = software_version_minor;
                objsoftwaremst.Software_registered_to           = software_registered_to;
                objsoftwaremst.Software_registration_code       = software_registration_code;
                objsoftwaremst.Software_registered_organization = software_registered_organization;
                objsoftwaremst.Software_product_key             = software_product_key;
                objsoftwaremst.Installed_on                     = installed_on;
                objsoftwaremst.Insert();
            }


            // objnetwork.Insert();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
 public int Update_Asset_mst_By_id(Asset_mst objAsset)
 {
     return (int)ExecuteNonQuery(Sp_Asset_Update, new object[] { objAsset.Assetid, objAsset.Computername, objAsset.Createdatetime, objAsset.Domain, objAsset.TagNo, objAsset.PONo, objAsset.IsInStock });
 }
    public void Asset_Network_Info(XmlDocument xmldoc)
    {
        try
        {
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;
            XmlNode adapter = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter");
            XmlNode protocol = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter//Network_protocols//Protocol");
            XmlNode protocol_IP_Addresses_Address = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter//Network_protocols//Protocol//IP_Addresses//Address//Address");
            XmlNode protocol_Gateways = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Adapter//Network_protocols//Protocol//Gateways");
            XmlNode Link_speed = xmldoc.DocumentElement.SelectSingleNode("//Computer//Network_adapters//Link_speed");

            Asset_mst objAsset = new Asset_mst();
            int varassetid = objAsset.Get_Current_Assetid();
            Asset_Network_mst objnetwork = new Asset_Network_mst();
            objnetwork.Adapter_name = adapter.InnerText;
            if (count1 == 0)
            {
                objnetwork.Assetid = varassetid;
            }
            else
            {
                objnetwork.Assetid = Assetid;
            }

            objnetwork.Gateway = protocol_Gateways.InnerText;
            objnetwork.Inventory_date = inventorydate2;
            //change done by meenakshi
            if (protocol_IP_Addresses_Address != null)
            {
                objnetwork.Ip_address = protocol_IP_Addresses_Address.InnerText;
            }
            if (Link_speed != null)
            {
                objnetwork.Link_speed = Link_speed.InnerText;
            }
            if (protocol != null)
            {
                objnetwork.Protocol_name = protocol.InnerText;
            }
            objnetwork.Insert();

        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
 public int Insert_Asset_mst(Asset_mst objAsset)
 {
     return (int)ExecuteNonQuery(Sp_Asset_Insert, new object[] { objAsset.Domain, objAsset.Createdatetime, objAsset.Computername, objAsset.TagNo, objAsset.PONo, objAsset.IsInStock });
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        int flagStatus = 0;
        XmlDocument xmldoc = new XmlDocument();
        int temp = Convert.ToInt16(Session["temp"]);
        if (temp == 1)
        {
            string compname1 = (string)(Session["param_node"]);
            objasset = objasset.Get_Asset_By_Computername(compname1);
            int assetid = Convert.ToInt16(objasset.Assetid);
            lblAssetId.Text = assetid.ToString();
            string path = "C:\\Asset\\Data\\" + compname1 + ".xml";
            flagStatus = 1;
            String filestr = File.ReadAllText(path);
            xmldoc.LoadXml(filestr);
            //xmldoc.Load(path);
        }
        else
        {
            string compane = Request.QueryString[0];
            string assetid = (string)(Session["Assetid"]);
            lblAssetId.Text = assetid;

            DirectoryInfo di = new DirectoryInfo("C://Asset//Data");
            FileInfo[] fi = di.GetFiles();
            foreach (FileInfo K in fi)
            {
                string[] fname = K.Name.Split(new char[] { '.' });

                if (fname[0].ToString() == compane)
                {
                    string path = "C:\\Asset\\Data\\" + compane + ".xml";
                    String filestr = File.ReadAllText(path);
                    xmldoc.LoadXml(filestr);
                //    xmldoc.Load(path);
                    flagStatus = 1;

                }

            }

        }
        if (flagStatus == 1)
        {
            #region Call Display Function
            DisplayComputerDetails(xmldoc);
            DisplayProcessorDetails(xmldoc);
            DisplayProductDetails(xmldoc);
            DisplayMemoryDetails(xmldoc);
            DisplayOSDetails(xmldoc);
            DisplayPhysicalDriveDetails(xmldoc);
            DisplayLogicalDriveDetails(xmldoc);
            DisplayNetworkDetails(xmldoc);
            #endregion

            visiblefun();
            pancomputer.Visible = true;
        }
        else
        {

            string myScript;
            myScript = "<script language=javascript>alert('Computer not found!, Ensure that computer is in the Domain and User Login to the Domain.'); </script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.ClientScript.GetPostBackEventReference(this, "arg");

        int incidentid = Convert.ToInt16(Request.QueryString[0]);
        assetid = Convert.ToInt16(objincitiasset.Get_AssetId_By_incidentId(incidentid));

        if (assetid != 0)//Incase of no asset assign to user.
        {
            assetid = Convert.ToInt16(objincitiasset.Get_AssetId_By_incidentId(incidentid));
            objaseetmst = objaseetmst.Get_By_id(assetid);
            string compname = objaseetmst.Computername;
            XmlDocument xmldoc = new XmlDocument();
            DirectoryInfo di = new DirectoryInfo("C://Asset//Data");
            FileInfo[] fi = di.GetFiles();
            foreach (FileInfo K in fi)
            {
                string[] fname = K.Name.Split(new char[] { '.' });

                if (fname[0].ToString() == compname)
                {
                    string path = "C:\\Asset\\Data\\" + compname + ".xml";
                    String filestr = File.ReadAllText(path);
                    xmldoc.LoadXml(filestr);
                    // xmldoc.Load(path);
                    DisplayComputerDetails(xmldoc);

                }

            }
            // string path = "C:\\Asset\\Data\\" + compname + ".xml";
            //xmldoc.Load(path);

        }

        ///////////////////////changed///////////////////////////

        ///////////////////////////////////////////////////////////
        if (!IsPostBack)
        {
            LnkAttachment.Visible = false;
            lbltimespentonDisp.Visible = false;
            lbltimespentonreq.Text = "";
            pan1.Visible = true;
            pan2.Visible = false;
            UpdatePanel1();
            PanelShowNotes();
            /////////////////////////////////////added by lalit joshi ///////////////////////////////
            DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/FileAttach"));
            FileInfo[] fileinfo = dir.GetFiles();

            foreach (FileInfo f in fileinfo)
            {
                string[] str = f.Name.Split(new char[] { '.' });
                if (str[0] == Convert.ToString(incidentid))
                {
                    LnkAttachment.Visible = true;
                }

            }
            ////////////////////////////////////////////////////////////////////////////////////////////////
        }

        HistoryUpdatePanel();
        string CMDBUpdate = "";
        if (Session["CMDBUpdate"] != null)
        {
            CMDBUpdate = Session["CMDBUpdate"].ToString();
        }

        if (CMDBUpdate == "true")
        {
            pan1.Visible = false;
            pan2.Visible = true;
            UpdatePanel2();
            lnkEdit.Visible = false;
            btnCancel.Visible = true;
            btnUpdate.Visible = true;
            HistoryUpdatePanel();
            drpStatus.SelectedValue = Session["drpStatus.SelectedValue"].ToString();
            drpMode.SelectedValue = Session["drpMode.SelectedValue"].ToString();
            drpCategory.SelectedValue = Session["drpCategory.SelectedValue"].ToString();
            drpSubcategory.SelectedValue = Session["drpSubcategory.SelectedValue"].ToString();

            Session["CMDBUpdate"] = "false";
            FunctionUpdate();
        }
    }
    public void Asset_Physical_Drive_Info(XmlDocument xmldoc)
    {
        try
        {
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;
            XmlNode physical_drives = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Drive");
            XmlNode Capacity = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Capacity");
            XmlNode Manufacturer = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Manufacturer");
            XmlNode physical_drives1 = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Product_version");
            XmlNode Product_version = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Drive");
            XmlNode Serial_number = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Physical_drives//Serial_number");
            Asset_mst objAsset = new Asset_mst();
            int varassetid = objAsset.Get_Current_Assetid();
            Asset_PhysicalDrive_mst objphysical = new Asset_PhysicalDrive_mst();
            if (count1 == 0)
            {
                objphysical.Assetid = varassetid;
            }
            else
            {
                objphysical.Assetid = Assetid;
            }

            objphysical.Capacity = Capacity.InnerText;
            objphysical.Drive_name = physical_drives.InnerText;
            objphysical.Inventory_date = inventorydate2;
            objphysical.Manufacturer = Manufacturer.InnerText;
            objphysical.Product_version = Product_version.InnerText;
            objphysical.Serial_number = Serial_number.InnerText;
            objphysical.Insert();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
    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 void Asset_Memory_Info(XmlDocument xmldoc)
    {
        try
        {
            XmlNode inventory_date = xmldoc.DocumentElement.SelectSingleNode("//Computer//Created_on");
            inventorydate2 = inventory_date.InnerText;
            XmlNode physical_mem = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Memory//Physical_memory");
            XmlNode virtual_mem = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Memory//Virtual_memory");
            XmlNode page_file = xmldoc.DocumentElement.SelectSingleNode("//Computer//Hardware//Memory//Page_file_size");
            Asset_mst objAsset = new Asset_mst();
            int varassetid = objAsset.Get_Current_Assetid();

            Asset_Memory_mst objmemory = new Asset_Memory_mst();
            if (count1 == 0)
            {
                objmemory.Assetid = varassetid;
            }
            else
            {
                objmemory.Assetid = Assetid;
            }

            objmemory.Inventory_date = inventorydate2;
            objmemory.Page_file = page_file.InnerText;
            if (physical_mem.InnerText != "")
            {
                if (Convert.ToDecimal(physical_mem.InnerText) >= 1073741824)
                {
                    decimal physicalmem = Convert.ToDecimal(physical_mem.InnerText) / 1073741824;
                    //objmemory.Physical_mem = physicalmem.ToString() + " GB";
                    objmemory.Physical_mem = String.Format("{0:0.00}", physicalmem) + " GB";

                }
                else
                {
                    decimal physicalmem = Convert.ToDecimal(physical_mem.InnerText) / 1048576;
                    //objmemory.Physical_mem = physicalmem.ToString() + " MB";
                    objmemory.Physical_mem = String.Format("{0:0.00}", physicalmem) + " MB";
                }
            }
            //   objmemory.Physical_mem = physical_mem.InnerText;
            if (virtual_mem.InnerText != "")
            {
                if (Convert.ToDecimal(virtual_mem.InnerText) >= 1073741824)
                {
                    decimal virtualmem = Convert.ToDecimal(virtual_mem.InnerText) / 1073741824;
                    objmemory.Virtual_mem = String.Format("{0:0.00}", virtualmem) + " GB";

                }
                else
                {
                    decimal virtualmem = Convert.ToDecimal(virtual_mem.InnerText) / 1048576;
                    objmemory.Virtual_mem = String.Format("{0:0.00}", virtualmem) + " MB";
                }
            }
            //  objmemory.Virtual_mem = virtual_mem.InnerText;
            objmemory.Insert();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int         flagStatus = 0;
        XmlDocument xmldoc     = new XmlDocument();
        int         temp       = Convert.ToInt16(Session["temp"]);

        if (temp == 1)
        {
            string compname1 = (string)(Session["param_node"]);
            objasset = objasset.Get_Asset_By_Computername(compname1);
            int assetid = Convert.ToInt16(objasset.Assetid);
            lblAssetId.Text = assetid.ToString();
            string path = "C:\\Asset\\Data\\" + compname1 + ".xml";
            flagStatus = 1;
            String filestr = File.ReadAllText(path);
            xmldoc.LoadXml(filestr);
            //xmldoc.Load(path);
        }
        else
        {
            string compane = Request.QueryString[0];
            string assetid = (string)(Session["Assetid"]);
            lblAssetId.Text = assetid;

            DirectoryInfo di = new DirectoryInfo("C://Asset//Data");
            FileInfo[]    fi = di.GetFiles();
            foreach (FileInfo K in fi)
            {
                string[] fname = K.Name.Split(new char[] { '.' });

                if (fname[0].ToString() == compane)
                {
                    string path    = "C:\\Asset\\Data\\" + compane + ".xml";
                    String filestr = File.ReadAllText(path);
                    xmldoc.LoadXml(filestr);
                    //    xmldoc.Load(path);
                    flagStatus = 1;
                }
            }
        }
        if (flagStatus == 1)
        {
            #region Call Display Function
            DisplayComputerDetails(xmldoc);
            DisplayProcessorDetails(xmldoc);
            DisplayProductDetails(xmldoc);
            DisplayMemoryDetails(xmldoc);
            DisplayOSDetails(xmldoc);
            DisplayPhysicalDriveDetails(xmldoc);
            DisplayLogicalDriveDetails(xmldoc);
            DisplayNetworkDetails(xmldoc);
            #endregion

            visiblefun();
            pancomputer.Visible = true;
        }
        else
        {
            string myScript;
            myScript = "<script language=javascript>alert('Computer not found!, Ensure that computer is in the Domain and User Login to the Domain.'); </script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
        }
    }
    protected void btnMapped_Click(object sender, EventArgs e)
    {
        //lblErrorMsg.Text = "";
        int flag = 0;
        int tempuser;

        tempuser = Convert.ToInt16(Session["tempuser"]);

        foreach (GridViewRow gv in grdvwViewAsset.Rows)
        {
            string      gvIDs;
            RadioButton selectonebutton = (RadioButton)gv.FindControl("selectone");
            if (selectonebutton.Checked)
            {
                flag = 1;
                int assetid;
                gvIDs   = ((Label)gv.FindControl("lblAssetID")).Text.ToString();
                assetid = Convert.ToInt16(gvIDs);
                string Username = lblusername.Text.ToString().Trim();
                objUser = objUser.Get_UserLogin_By_UserName_Like(Username);
                userid  = objUser.Userid;
                if (lblusername.Text == "")
                {
                    //lblErrorMsg.Text = "Enter the user name for mapped a particular Asset";
                    break;
                }

                else if (tempuser == 1)
                {
                    assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid);
                    int tempuser1 = 0;
                    if (assetcount == 0)
                    {
                        int flag1 = 1;
                        ObjAsset = ObjAsset.Get_By_id(assetid);
                        string compname = ObjAsset.Computername.ToString();
                        string username = lblusername.Text.ToString();
                        Session["compname"]  = compname;
                        Session["flag"]      = flag1;
                        Session["username"]  = username;
                        Session["assetid"]   = assetid;
                        Session["userid"]    = userid;
                        tempuser1            = 1;
                        Session["tempuser1"] = tempuser1;
                        Session["flag1"]     = flag1;
                        break;
                    }
                    else
                    {
                        //lblErrorMsg.Text = "Asset already mapped";
                        break;
                    }
                }
                else if (userid == 0)
                {
                    //lblErrorMsg.Text = "User Name doen not exist";
                    break;
                }
                else
                {
                    assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid);
                    usercount  = objusertoasset.Get_UserId_From_UserToAssetMap(userid);
                    if (assetcount == 0)
                    {
                        if (usercount == 0)
                        {
                            int flag1 = 1;
                            objusertoasset.Insert(userid, assetid);
                            //lblErrorMsg.Text = "Mapped Succussfully";
                            ObjAsset = ObjAsset.Get_By_id(assetid);
                            string compname = ObjAsset.Computername.ToString();
                            string username = lblusername.Text.ToString();
                            Session["compname"] = compname;
                            Session["flag"]     = flag1;
                            Session["username"] = username;
                            Session["assetid"]  = assetid;
                            Session["userid"]   = userid;
                            Session["flag1"]    = flag1;
                            break;
                        }
                        else  //Update Asset id from UserToAsset table.
                        {
                            int flag1      = 1;
                            int oldassetid = Convert.ToInt16(Session["assignassetid"]);
                            objusertoasset.Update_Assetid(oldassetid, assetid);
                            ObjAsset = ObjAsset.Get_By_id(assetid);
                            string compname = ObjAsset.Computername.ToString();
                            string username = lblusername.Text.ToString();
                            Session["compname"] = compname;
                            Session["flag"]     = flag1;
                            Session["username"] = username;
                            Session["assetid"]  = assetid;
                            Session["userid"]   = userid;
                            Session["flag1"]    = flag1;
                            break;
                        }
                    }
                    else
                    {
                        //lblErrorMsg.Text = "Asset already mapped";
                        break;
                    }
                }
            }
        }
        if (flag == 0)
        {
            //lblErrorMsg.Text = "Select Asset for mapping";
        }

        string myScript;

        myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>";
        Page.RegisterClientScriptBlock("MyScript", myScript);
    }