It is not working.
Data Formates: mm/dd/yyyy
COMP_ID |
EMP_ID |
COMP_MESSAGE |
Comp_type |
STATUS_ID |
COMP_LODGE_DATE |
CLOSING_DATE |
REMARKS |
S_GUID |
remote_ip |
who |
user_feedback |
type |
ATTEND_DATE |
ATTEND_BY |
Image |
remote_A_ip |
3907 |
101846 |
Application -:- Userid/Password Problem :- DM Plant - :- G3 E-Shift Log password for Employee no 101846 not working. |
IT COMPLAINT |
2 |
2/22/2022 |
NULL |
NULL |
NULL |
NULL |
|
NULL |
NULL |
|
|
|
NULL |
3908 |
100569 |
Application -:- Finmat :- H-type :- CnM: FINMAT installation reqd |
IT COMPLAINT |
2 |
2/22/2022 |
NULL |
NULL |
NULL |
NULL |
|
NULL |
NULL |
|
|
|
NULL |
3909 |
900148 |
PC -:- Mouse Problem :- H-type :- HR |
IT COMPLAINT |
2 |
2/22/2022 |
NULL |
NULL |
NULL |
NULL |
|
NULL |
NULL |
|
|
|
NULL |
3910 |
090504 |
Network -:- Internet Problem :- H-type |
IT COMPLAINT |
2 |
2/22/2022 |
NULL |
NULL |
NULL |
NULL |
|
NULL |
NULL |
|
|
|
NULL |
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Net;
using System.Drawing;
namespace OCMS
{
public partial class admin : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(@"Data Source=10.1.246.4;Initial Catalog=OCMS;User ID=dba_ntpc_meja_intranet;Password=alpha$890;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
refreshdata();
}
}
protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
SqlConnection con = new SqlConnection(@"Data Source=10.1.246.4;Initial Catalog=OCMS;User ID=dba_ntpc_meja_intranet;Password=alpha$890;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
DropDownList DropDownList1 = (e.Row.FindControl("DropDownList1") as DropDownList);
SqlCommand cmd = new SqlCommand("select * from complaint_status", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
DropDownList1.DataSource = dt;
DropDownList1.DataTextField = "STATUS_NAME";
DropDownList1.DataValueField = "STATUS_NAME";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, new ListItem("--SELECT_STATUS--", "0"));
DropDownList DropDownList2 = (e.Row.FindControl("DropDownList2") as DropDownList);
cmd = new SqlCommand("select * from Assign_to", con);
sda = new SqlDataAdapter(cmd);
dt = new DataTable();
sda.Fill(dt);
DropDownList2.DataSource = dt;
DropDownList2.DataTextField = "STATUS_NAME";
DropDownList2.DataValueField = "STATUS_NAME";
DropDownList2.DataBind();
DropDownList2.Items.Insert(0, new ListItem("--SELECT_NAME--", "0"));
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView dr = (DataRowView)e.Row.DataItem;
HtmlImage img = e.Row.FindControl("Image1") as HtmlImage;
if (!Convert.IsDBNull(dr["Image"]))
{
(e.Row.FindControl("Image1") as HtmlImage).Src = dr["Image"].ToString();
}
else
{
img.Visible = false;
}
DateTime dateTime = Convert.ToDateTime((e.Row.FindControl("lblDate") as Label).Text);
if (dateTime.Subtract(DateTime.Now).TotalHours < 12)
{
e.Row.BackColor = Color.Green;
}
if (dateTime.Subtract(DateTime.Now).TotalHours > 24)
{
e.Row.BackColor = Color.Red;
}
}
}
public void refreshdata()
{
con.Open();
//SqlCommand cmd = new SqlCommand("select * from comp_box where closing_date IS NULL ORDER BY COMP_ID DESC ", con);
SqlCommand cmd = new SqlCommand("select * from comp_box,emp where closing_date IS NULL and comp_box.emp_id=emp.emp_id order by comp_lodge_date desc", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
con.Close();
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void Update(object sender, EventArgs e)
{
GridViewRow row = (sender as Button).NamingContainer as GridViewRow;
DropDownList dropDownList1 = row.FindControl("DropDownList1") as DropDownList;
DropDownList dropDownList2 = row.FindControl("DropDownList2") as DropDownList;
if (dropDownList1.SelectedIndex > 0)
{
dropDownList1.Enabled = false;
}
if (dropDownList2.SelectedIndex > 0)
{
dropDownList2.Enabled = false;
}
int COMP_ID = Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32((sender as Button).CommandArgument)].Values[0]);
string STATUS_ID = dropDownList1.SelectedItem.Text;
string ATTEND_BY = dropDownList2.SelectedItem.Text;
// string remark = (row.FindControl("TextBox5") as TextBox).Text;
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("UPDATE comp_box SET STATUS_ID = @STATUS_ID, ATTEND_BY = @ATTEND_BY WHERE COMP_ID = @COMP_ID"))
{
cmd.Parameters.AddWithValue("@STATUS_ID", STATUS_ID);
cmd.Parameters.AddWithValue("@ATTEND_BY", ATTEND_BY);
cmd.Parameters.AddWithValue("@COMP_ID", COMP_ID);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}
protected void Closed(object sender, EventArgs e)
{
GridViewRow row = (sender as Button).NamingContainer as GridViewRow;
int COMP_ID = Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32((sender as Button).CommandArgument)].Values[0]);
string STATUS_ID = "02";
string remark = (row.FindControl("TextBox5") as TextBox).Text;
string CLOSING_DATE = DateTime.Now.ToString();
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("UPDATE comp_box SET STATUS_ID = @STATUS_ID, REMARKS = @REMARKS,CLOSING_DATE = @CLOSING_DATE WHERE COMP_ID = @COMP_ID"))
{
cmd.Parameters.AddWithValue("@COMP_ID", COMP_ID);
cmd.Parameters.AddWithValue("@STATUS_ID", STATUS_ID);
cmd.Parameters.AddWithValue("@REMARKS", remark);
cmd.Parameters.AddWithValue("@CLOSING_DATE", CLOSING_DATE);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string PHONE_MOB = row.Cells[4].Text;
string SMSurl = string.Format("http://185.255.8.59/sms/1/text/query?username=NTpc&password=NTpc@321&from=MUNPLA&to={0}&text=Your OCMS Complaint No:{1} has been resolved successfully - Meja Urja Nigam PVT. LTD. &indiaDltContentTemplateId=1207164466650628862&indiaDltPrincipalEntityId=1201159222154902387", PHONE_MOB, COMP_ID);
//string SMSurl = "http://185.255.8.59/sms/1/text/query?username=NTpc&password=NTpc@321&from=MUNPLA&to= + PHONE_MOB + &text=Your OCMS Complaint No:" + COMP_ID + " has been resolved successfully - Meja Urja Nigam PVT. LTD. &indiaDltContentTemplateId=1207164466650628862&indiaDltPrincipalEntityId=1201159222154902387";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SMSurl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
GridView1.EditIndex = -1;
row.Visible = false;
}
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" Codefile="admin.aspx.cs" Inherits="OCMS.admin" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="css/StyleSheet2.css" rel="stylesheet" />
<head id="Head1" runat="server">
<title></title>
<style type="text/css">
.auto-style17 {
font-size: medium;
}
#form1 {
color: #FFFFFF;
background-color: #3399FF;
}
</style>
</head>
<body class="auto-style17">
<form id="form1" runat="server">
<div>
<span class="style1"><strong>COMPLAINT MANAGEMENT SYSTEM</strong></span>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
CellPadding="3" DataKeyNames="COMP_ID"
OnRowDataBound="GridView1_RowDataBound" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" >
<Columns>
<asp:TemplateField HeaderText = "SL. No." ItemStyle-Width="10">
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="10px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="COMP_ID" HeaderText="COMP_ID " >
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="EMP_ID" HeaderText="EMP_ID" >
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="EMP_NAME" HeaderText="EMP_NAME" >
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="PHONE_MOB" HeaderText="PHONE_MOB" >
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundField>
<asp:BoundField ItemStyle-Width="400px" DataField="COMP_MESSAGE" HeaderText="COMP_MESSAGE" >
<ItemStyle Width="600px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="COMP_LODGE_DATE">
<ItemTemplate>
<asp:Label ID="lblDate" Text='<%# Eval("COMP_LODGE_DATE" ) %>' runat="server" DataFormatString="{0:dd/MM/yyyy}"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status Name">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Assign to">
<ItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server" Enabled="true" >
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remark">
<ItemTemplate>
<asp:TextBox ID="TextBox5" runat="server">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button1" Text="Save" runat="server" CommandName="Save" OnClick="Update" CommandArgument="<%# Container.DataItemIndex %>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button2" Text="Closed" runat="server" CommandName="Closed" OnClick="Closed" CommandArgument="<%# Container.DataItemIndex %>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<img id="Image1" runat="server" alt="" height="50" width="50" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
<div id="dialog" style="display: none">
</div>
</div>
</table>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/start/jquery-ui.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$("#dialog").dialog({
autoOpen: false,
modal: true,
height: 600,
width: 600,
title: "Zoomed Images"
});
$("[id*=GridView1] img").click(function () {
$('#dialog').html('');
$('#dialog').append($(this).clone());
$('#dialog').dialog('open');
});
});
</script>
</form>