private void SearchBtn_Click(object sender, EventArgs e) { if (SearchStaffID.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); SearchStaffID.Focus(); return; } if (Datefrom.Text.Trim() == "") { MessageBox.Show("Please Enter Date From ID"); Datefrom.Focus(); return; } if (dateto.Text.Trim() == "") { MessageBox.Show("Please Enter Date To ID"); dateto.Focus(); return; } AttenDanceGRID.Rows.Clear(); int SL = 1; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; string s5 = ""; string s6 = ""; string s7 = ""; string s8 = ""; string s9 = ""; string s10 = ""; string s11 = ""; string query = "SELECT * FROM AttendanceReportView WHERE StaffID = " + Convert.ToInt32(SearchStaffID.Text) + " AND Date BETWEEN '" + Datefrom.Value.ToString("yyyy/MM/dd") + "' AND '" + dateto.Value.ToString("yyyy/MM/dd") + "'"; SqlDataReader reader = DbAccess.GetFromDB(query); if (reader.HasRows) { while (reader.Read()) { s1 = SL.ToString(); s2 = SearchStaffID.Text.ToString(); s3 = reader["StaffName"].ToString(); s4 = reader["Department"].ToString(); s5 = reader["Date"].ToString(); s6 = reader["InTime"].ToString(); s7 = reader["OutTime"].ToString(); s8 = reader["Status"].ToString(); AttenDanceGRID.Rows.Add(s1, s2, s3, s4, s5, s6, s7, s8); SL++; } } DbAccess.connnection.Close(); }
public void addExtra(string make, string model, int datefrom, int dateto) { for (int i = 0; i < Counter; i++) { if (Make[i] == make && Model[i] == model && Datefrom[i] == datefrom && Dateto[i] == dateto) { return; } } Model.Add(model); Make.Add(make); Datefrom.Add(datefrom); Dateto.Add(dateto); Counter++; }
protected void lnkbtnPreview_OnClick(object sender, EventArgs e) { try { if (Datefrom.Text.Trim() != "" && txtDateTo.Text.Trim() != "") { if (Convert.ToDateTime(ApplicationFunction.mmddyyyy(Datefrom.Text.Trim())) > Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text.Trim()))) { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "ShowMessage('From date can not be greater than To date!');", true); Datefrom.Focus(); return; } } DataSet CompDetl = SqlHelper.ExecuteDataset(ApplicationFunction.ConnectionString(), CommandType.Text, "select ISNULL(cm.Comp_Name,'')Comp_Name,ISNULL(cm.Adress1,'')as Address1,ISNULL(cm.Adress2,'')as Address2,ISNULL(cm.City_Idno,'')as City_Name,ISNULL(cm.State_Idno,'')as State_Name,ISNULL(cm.Phone_Off,'')as Phone_Off,ISNULL(cm.Pan_No,'')as PAN_No,ISNULL(cm.CompGSTIN_No,'')as GST_No,ISNULL(cm.Pin_No,'')as Pin_No from tblcompmast cm "); if (CompDetl != null) { if (CompDetl != null && CompDetl.Tables.Count > 0 && CompDetl.Tables[0].Rows.Count > 0) { string CompName = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["Comp_Name"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["Comp_Name"]); string Add1 = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["Address1"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["Address1"]); string Add2 = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["Address2"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["Address2"]); string PhNo = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["Phone_Off"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["Phone_Off"]); string City = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["City_Name"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["City_Name"]); string State = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["State_Name"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["State_Name"]); string Pin_No = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["Pin_No"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["Pin_No"]); string GST_No = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["GST_No"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["GST_No"]);; string PAN_No = string.IsNullOrEmpty(Convert.ToString(CompDetl.Tables[0].Rows[0]["PAN_No"])) ? "" : Convert.ToString(CompDetl.Tables[0].Rows[0]["PAN_No"]); if (string.IsNullOrEmpty(Add2) == false) { Add1 = Add1 + "," + Add2; } if (string.IsNullOrEmpty(City) == false) { Add1 = Add1 + "," + City; } if (string.IsNullOrEmpty(State) == false) { Add1 = Add1 + "," + State; } if (string.IsNullOrEmpty(Pin_No) == false) { Add1 = Add1 + "," + Pin_No; } if (string.IsNullOrEmpty(PhNo) == false) { PhNo = "PHONE:- " + PhNo; } if (string.IsNullOrEmpty(PAN_No) == false) { PAN_No = "PAN:- " + PAN_No; } if (string.IsNullOrEmpty(GST_No) == false) { GST_No = "GST No:- " + GST_No; } lblCompName.Text = CompName; lblCompAddress.Text = Add1; lblCompPhone.Text = PhNo; lblGST.Text = GST_No; lblPAN.Text = PAN_No; } } DataTable dsTableMain = BindProfitLoss(); if (dsTableMain != null && dsTableMain.Rows.Count > 0) { grdMain.DataSource = dsTableMain; grdMain.DataBind(); imgPrint.Visible = true; imgBtnExcel.Visible = true; } else { grdMain.DataSource = dsTableMain; grdMain.DataBind(); imgPrint.Visible = false; imgBtnExcel.Visible = false; } } catch (Exception Ex) { throw (Ex); } }