protected void TxtDate_TextChanged(object sender, EventArgs e) { try { if (TxtDate.Text.Length != 0) { StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select D.Working_Date"); StrSql.AppendLine("From DailyAttendance D"); StrSql.AppendLine("Where D.EmpId=" + int.Parse(ddlEmployee.SelectedValue)); StrSql.AppendLine("And D.Working_Date='" + ValueConvert.ConvertDate(TxtDate.Text.ToString()) + "'"); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); if (dtTemp.Rows.Count != 0) { LblMsg.Text = "Attendance Entry Allready Done For " + TxtDate.Text.ToString() + "."; TxtDate.Text = ""; TxtDays.Text = ""; TxtMonth.Text = ""; TxtDate.Focus(); return; } LblMsg.Text = ""; GetDayMonth(); TxtInTime.Focus(); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void BtnShow_Click(object sender, EventArgs e) { try { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("AttendanceInfoRV.rdlc"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select E.EmpName"); StrSql.AppendLine(",DATEPART(Year,Working_Date) As Working_Year,D.Working_Month "); StrSql.AppendLine(",D.Working_Days,Convert(Varchar(10),D.Working_Date,103) As Working_Date "); StrSql.AppendLine(",D.InTime,D.OutTime,D.TotWork_Hours "); StrSql.AppendLine(",D.OverTime,D.LessTime "); StrSql.AppendLine(",D.Reason,D.Remark "); StrSql.AppendLine("From DailyAttendance D"); StrSql.AppendLine("Left Join Emp_Mast E On E.Id=D.EmpId"); StrSql.AppendLine("Where 1=1"); if (ddlEmployee.SelectedValue != "0") { StrSql.AppendLine("And D.EmpId=" + int.Parse(ddlEmployee.SelectedValue.ToString())); } if (ddlyear.SelectedValue != "0") { StrSql.AppendLine("And DATEPART(Year,D.Working_Date)=" + int.Parse(ddlyear.SelectedValue)); } if (ddlmonth.SelectedValue != "0") { StrSql.AppendLine("And D.Working_Month='" + ddlmonth.Text.ToString() + "'"); } if (TxtFDate.Text.Trim() != "") { StrSql.AppendLine("And D.Working_Date >='" + ValueConvert.ConvertDate(TxtFDate.Text.Trim()) + "'"); } if (TxtTDate.Text.Trim() != "") { StrSql.AppendLine("And D.Working_Date <='" + ValueConvert.ConvertDate(TxtTDate.Text.Trim()) + "'"); } StrSql.AppendLine("Order By E.EmpName,DATEPART(Year,D.Working_Date),DATEPART(MONTH,D.Working_Date),Convert(Varchar(10),D.Working_Date,103)"); HRMDataSet dsAssWorkInfo = ComFunc.GetData(StrSql.ToString().Replace("\r\n", " "), "AttendanceInfo"); ReportDataSource WorkDataSource = new ReportDataSource("AttendanceInfo", dsAssWorkInfo.Tables["AttendanceInfo"]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(WorkDataSource); } catch { Response.Redirect("~/ErrorPage.aspx"); } }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { if (TxtCompleteDate.Text.Length != 0) { LblMsg.Text = "Complete Date Is Blank !!!"; TxtCompleteDate.Focus(); return; } if (TxtCompleteTime.Text.Length != 0) { LblMsg.Text = "Complete Time Is Blank !!!"; TxtCompleteTime.Focus(); return; } if (ddlWrkStatus.SelectedValue == "0") { LblMsg.Text = "Select Work Status...."; ddlWrkStatus.Focus(); return; } if (HidFldId.Value.Length == 0) { StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Update WorkAssDet"); StrSql.AppendLine("Set CompleteDate=@CompleteDate"); StrSql.AppendLine(",CompleteTime=@CompleteTime"); StrSql.AppendLine(",WorkStatus=@WorkStatus"); StrSql.AppendLine("Where Id=@ID"); Cmd.Parameters.AddWithValue("@CompleteDate", ValueConvert.ConvertDate(TxtCompleteDate.Text)); Cmd.Parameters.AddWithValue("@CompleteTime", TxtCompleteTime.Text); Cmd.Parameters.AddWithValue("@WorkStatus", ddlWrkStatus.SelectedValue); Cmd.Parameters.AddWithValue("@ID", HidFldId.Value.ToString()); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry updated successfully"; } else { LblMsg.Text = "Id Is Blank !!!"; } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void GridModule_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int Id = Convert.ToInt32(GridModule.DataKeys[e.RowIndex].Value.ToString()); int Projectid = Convert.ToInt32(GridModule.DataKeys[e.RowIndex].Values["ProjectId"].ToString()); TextBox TxtModName = (TextBox)GridModule.Rows[e.RowIndex].FindControl("TxtEditModName"); TextBox TxtModStartDate = (TextBox)GridModule.Rows[e.RowIndex].FindControl("TxtEditStartDate"); TextBox TxtModEndDate = (TextBox)GridModule.Rows[e.RowIndex].FindControl("TxtEditEndDate"); DropDownList DDlModStat = (DropDownList)GridModule.Rows[e.RowIndex].FindControl("DDlEditModStat"); TextBox TxtRemark = (TextBox)GridModule.Rows[e.RowIndex].FindControl("TxtEditRemark"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Update Project_Module "); StrSql.AppendLine("Set StartDate='" + ValueConvert.ConvertDate(TxtModStartDate.Text) + "'"); if (TxtModEndDate.Text.Length != 0) { StrSql.AppendLine(",EndDate='" + ValueConvert.ConvertDate(TxtModEndDate.Text) + "'"); } else { StrSql.AppendLine(",EndDate=NULL"); } StrSql.AppendLine(",ModuleStatus='" + DDlModStat.Text + "'"); StrSql.AppendLine(",Remark='" + TxtRemark.Text + "'"); StrSql.AppendLine(",UPDFLAG=ISNULL(UPDFLAG,0)+1"); StrSql.AppendLine(",MEntry_Date=GetDate()"); StrSql.AppendLine(",MEntry_Time=CONVERT(VarChar,GetDate(),108)"); StrSql.AppendLine(",MEntry_UID='" + HidFldUID.Value.ToString() + "'"); StrSql.AppendLine("Where Id=" + Id); StrSql.AppendLine("And ProjectId=" + Projectid); SqlFunc.ExecuteNonQuery(StrSql.ToString()); GridModule.EditIndex = -1; FillModuleData(); } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (DDLClientName.SelectedValue == "0") { //LblMsg.Text = "Select Client..."; DDLClientName.Focus(); return; } if (TxtPrjName.Text.Length == 0) { //LblMsg.Text = "Enter Project Name..."; TxtPrjName.Focus(); return; } StrSql = new StringBuilder(); StrSql.Length = 0; if (HidFldId.Value.Length == 0) { StrSql.AppendLine("Insert Into Project_Mast"); StrSql.AppendLine("(ClientId,ProjectName"); StrSql.AppendLine(",StartDate,EndDate"); StrSql.AppendLine(",ProjctStatus,Remark"); StrSql.AppendLine(",Entry_Date,Entry_Time"); StrSql.AppendLine(",Entry_UID,UPDFLAG)"); StrSql.AppendLine("Values"); StrSql.AppendLine("(@ClientId,@ProjectName"); StrSql.AppendLine(",@StartDate,@EndDate"); StrSql.AppendLine(",@ProjctStatus,@Remark"); StrSql.AppendLine(",GetDate(),CONVERT(Varchar,GETDATE(),108)"); StrSql.AppendLine(",@Entry_UID,0)"); } else { StrSql.AppendLine("Update Project_Mast"); StrSql.AppendLine("Set ClientId=@ClientId"); StrSql.AppendLine(",ProjectName=@ProjectName"); StrSql.AppendLine(",StartDate=@StartDate"); StrSql.AppendLine(",EndDate=@EndDate"); StrSql.AppendLine(",ProjctStatus=@ProjctStatus"); StrSql.AppendLine(",Remark=@Remark"); StrSql.AppendLine(",UPDFLAG=ISNULL(UPDFLAG,0)+1"); StrSql.AppendLine(",MEntry_Date=GETDATE()"); StrSql.AppendLine(",MEntry_Time=CONVERT(Varchar,GETDATE(),108)"); StrSql.AppendLine(",MEntry_UID=@Entry_UId"); StrSql.AppendLine("Where Id=@Id"); } Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); if (DDLClientName.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@ClientId", DDLClientName.SelectedValue); } else { Cmd.Parameters.AddWithValue("@ClientId", DBNull.Value); } Cmd.Parameters.AddWithValue("@ProjectName", TxtPrjName.Text); if (TxtStartDate.Text.Length != 0) { Cmd.Parameters.AddWithValue("@StartDate", ValueConvert.ConvertDate(TxtStartDate.Text)); } else { Cmd.Parameters.AddWithValue("@StartDate", DBNull.Value); } if (TxtEndDate.Text.Length != 0) { Cmd.Parameters.AddWithValue("@EndDate", ValueConvert.ConvertDate(TxtEndDate.Text)); } else { Cmd.Parameters.AddWithValue("@EndDate", DBNull.Value); } if (ddlPrjStatus.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@ProjctStatus", ddlPrjStatus.SelectedValue); } else { Cmd.Parameters.AddWithValue("@ProjctStatus", DBNull.Value); } Cmd.Parameters.AddWithValue("@Remark", TxtRemark.Text); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); if (HidFldId.Value.Length == 0) { SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry insert successfully..."; } else { Cmd.Parameters.AddWithValue("@Id", int.Parse(HidFldId.Value)); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry update successfully..."; } FillGrid(); ClearAll(); MyMenu.Items[0].Selected = true; MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; MyMultiView.ActiveViewIndex = 0; } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (TxtCompName.Text.Length == 0) { //LblMsg.Text = "Company Name Is Blank, Enter Valid Company Name...."; TxtCompName.Focus(); return; } if (TxtStartDate.Text.Length == 0) { //LblMsg.Text = "Start Date Is Blank, Enter Valid Start Date...."; TxtStartDate.Focus(); return; } if (TxtMobNo.Text.Length == 0) { //LblMsg.Text = "Mob.No Is Blank, Enter Valid Mob.No...."; TxtMobNo.Focus(); return; } if (TxtEMailId.Text.Length == 0) { // LblMsg.Text = "Email Id Is Blank, Enter Valid Email Id...."; TxtEMailId.Focus(); return; } StrSql = new StringBuilder(); StrSql.Length = 0; if (HidFldId.Value.Length == 0) { StrSql.AppendLine("Insert Into Com_Mast (CompName,StartDate"); StrSql.AppendLine(",CountryId,StateId "); StrSql.AppendLine(",CityId,Address1,PinCode"); StrSql.AppendLine(",MobNo,Phone,EMailId"); StrSql.AppendLine(",WebSite"); StrSql.AppendLine(",Entry_Date,Entry_Time"); StrSql.AppendLine(",Entry_UID,UPDFLAG)"); StrSql.AppendLine("Values(@CompName,@StartDate"); StrSql.AppendLine(",@CountryId,@StateId "); StrSql.AppendLine(",@CityId,@Address1,@PinCode"); StrSql.AppendLine(",@MobNo,@Phone,@EMailId"); StrSql.AppendLine(",@WebSite"); StrSql.AppendLine(",GetDate(),Convert(VarChar,GetDate(),108)"); StrSql.AppendLine(",@Entry_UID,0)"); } else { StrSql.AppendLine("Update Com_Mast Set CompName=@CompName,StartDate=@StartDate"); StrSql.AppendLine(",CountryId=@CountryId,StateId=@StateId "); StrSql.AppendLine(",CityId=@CityId,Address1=@Address1,PinCode=@PinCode"); StrSql.AppendLine(",MobNo=@MobNo,Phone=@Phone,EMailId=@EMailId"); StrSql.AppendLine(",WebSite=@WebSite"); StrSql.AppendLine(",MEntry_Date=GetDate(),MEntry_Time=Convert(Varchar,GetDate(),108)"); StrSql.AppendLine(",MEntry_UID=@Entry_UID,UPDFLAG=IsNull(UPDFlag,0)+1"); StrSql.AppendLine("Where Id=@Id"); } Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); Cmd.Parameters.AddWithValue("@CompName", TxtCompName.Text.Trim()); Cmd.Parameters.AddWithValue("@StartDate", ValueConvert.ConvertDate(TxtStartDate.Text)); if (ddlCountry.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@CountryId", ddlCountry.SelectedValue); } else { Cmd.Parameters.AddWithValue("@CountryId", DBNull.Value); } if (ddlState.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@StateId", ddlState.SelectedValue); } else { Cmd.Parameters.AddWithValue("@StateId", DBNull.Value); } if (ddlCity.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@CityId", ddlCity.SelectedValue); } else { Cmd.Parameters.AddWithValue("@CityId", DBNull.Value); } Cmd.Parameters.AddWithValue("@Address1", TxtAddress1.Text.Trim()); Cmd.Parameters.AddWithValue("@PinCode", TxtPinCode.Text.Trim()); Cmd.Parameters.AddWithValue("@MobNo", TxtMobNo.Text.Trim()); Cmd.Parameters.AddWithValue("@Phone", TxtPhone.Text.Trim()); Cmd.Parameters.AddWithValue("@WebSite", TxtWebSite.Text.Trim()); Cmd.Parameters.AddWithValue("@EMailId", TxtEMailId.Text.Trim()); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); if (HidFldId.Value.Length == 0) { SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Company added successfully"; } else { Cmd.Parameters.AddWithValue("@ID", HidFldId.Value.ToString()); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Company updated successfully"; } FillGrid(); ClearAll(); MyMenu.Items[0].Selected = true; MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; MyMultiView.ActiveViewIndex = 0; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; } catch (Exception ex) { Response.Write(ex); } }
//protected void GridWork_SelectedIndexChanged(object sender, EventArgs e) //{ // try // { // HidFldId.Value = GridWork.DataKeys[GridWork.SelectedRow.RowIndex].Value.ToString(); // StrSql = new StringBuilder(); // StrSql.Length = 0; // StrSql.AppendLine("Select W.Id,W.PrjLedId,W.PrjId,W.PrjModId,CM.ClientName,W.EmpId"); // StrSql.AppendLine(",Convert(Varchar(10),W.AssignDate,103) As AssignDate,W.AssignTime"); // StrSql.AppendLine(",W.DueDays,Convert(Varchar(10),W.DueDate,103) As DueDate"); // StrSql.AppendLine(",W.WorkDet1,W.WorkDet2,W.WorkDet3,W.WorkStatus"); // StrSql.AppendLine(",Case When IsNull(W.CompleteDate,'')<>''"); // StrSql.AppendLine(" Then Convert(Varchar(10),W.CompleteDate,103) Else '' End As CompleteDate"); // StrSql.AppendLine(",W.CompleteTime,W.Remark"); // StrSql.AppendLine("From WorkAssDet W"); // StrSql.AppendLine("Left Join Emp_Mast PL On PL.Id=W.PrjLedId"); // StrSql.AppendLine("Left Join Emp_Mast E On E.Id=W.EmpId"); // StrSql.AppendLine("Left Join Project_Mast P On P.Id=W.PrjId"); // StrSql.AppendLine("Left Join Client_Mast CM On CM.Id=P.ClientId"); // StrSql.AppendLine("Left Join Project_Module M On M.Id=W.PrjModId"); // StrSql.AppendLine("Where W.Id=" + int.Parse(HidFldId.Value)); // dtTemp = new DataTable(); // dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); // if (dtTemp.Rows.Count == 0) // { // LblMsg.Text = "Data not found"; // return; // } // DDLPrjLed.Items.Clear(); // DDLPrjLed.DataSource = BLayer.FillEmp(" And IsNull(EmpGroup,'')='Ledger'"); // DDLPrjLed.DataValueField = "EmpId"; // DDLPrjLed.DataTextField = "EmpName"; // DDLPrjLed.DataBind(); // DDLPrjLed.Items.Insert(0, new ListItem("--Select Ledger--", "0")); // DDLPrjName.Items.Clear(); // DDLPrjName.DataSource = BLayer.FillProject(""); // DDLPrjName.DataValueField = "PrjId"; // DDLPrjName.DataTextField = "PrjName"; // DDLPrjName.DataBind(); // DDLPrjName.Items.Insert(0, new ListItem("--Select Project--", "0")); // DDLPrjModule.Items.Clear(); // DDLPrjModule.DataSource = BLayer.FillPrjModule(int.Parse(DDLPrjName.SelectedValue)); // DDLPrjModule.DataValueField = "ModId"; // DDLPrjModule.DataTextField = "ModName"; // DDLPrjModule.DataBind(); // DDLPrjModule.Items.Insert(0, new ListItem("--Select Module--", "0")); // ddlEmployee.Items.Clear(); // ddlEmployee.DataSource = BLayer.FillEmp(""); // ddlEmployee.DataValueField = "EmpId"; // ddlEmployee.DataTextField = "EmpName"; // ddlEmployee.DataBind(); // ddlEmployee.Items.Insert(0, new ListItem("--Select Employee--", "0")); // if (dtTemp.Rows[0]["PrjLedId"].ToString() != "") // { // DDLPrjLed.SelectedValue = dtTemp.Rows[0]["PrjLedId"].ToString(); // } // if (dtTemp.Rows[0]["PrjId"].ToString() != "") // { // DDLPrjName.SelectedValue = dtTemp.Rows[0]["PrjId"].ToString(); // } // if (dtTemp.Rows[0]["PrjModId"].ToString() != "") // { // DDLPrjModule.SelectedValue = dtTemp.Rows[0]["PrjModId"].ToString(); // } // if (dtTemp.Rows[0]["EmpId"].ToString() != "") // { // ddlEmployee.SelectedValue = dtTemp.Rows[0]["EmpId"].ToString(); // } // TxtClientName.Text = dtTemp.Rows[0]["ClientName"].ToString(); // TxtAssignDate.Text = dtTemp.Rows[0]["AssignDate"].ToString(); // TxtAssignTime.Text = dtTemp.Rows[0]["AssignTime"].ToString(); // TxtDueDays.Text = dtTemp.Rows[0]["DueDays"].ToString(); // TxtDueDate.Text = dtTemp.Rows[0]["DueDate"].ToString(); // TxtWrkDetails1.Text = dtTemp.Rows[0]["WorkDet1"].ToString(); // TxtWrkDetails2.Text = dtTemp.Rows[0]["WorkDet2"].ToString(); // TxtWrkDetails3.Text = dtTemp.Rows[0]["WorkDet3"].ToString(); // //ddlWrkStatus.Text = dtTemp.Rows[0]["WorkStatus"].ToString(); // if (dtTemp.Rows[0]["WorkStatus"].ToString() != "") // { // ddlWrkStatus.SelectedValue = dtTemp.Rows[0]["WorkStatus"].ToString(); // } // TxtCompleteDate.Text = dtTemp.Rows[0]["CompleteDate"].ToString(); // TxtCompleteTime.Text = dtTemp.Rows[0]["CompleteTime"].ToString(); // TxtRemark.Text = dtTemp.Rows[0]["Remark"].ToString(); // // Move to Edit Tab // MyMenu.Items[0].ImageUrl = "~/Images/ViewDisable.jpg"; // MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditEnable.jpg"; // MyMenu.Items[1].Selected = true; // MyMultiView.ActiveViewIndex = 1; // } // catch (Exception ex) // { // Response.Write(ex.ToString()); // } //} protected void BtnSave_Click(object sender, EventArgs e) { try { //if (DDLPrjLed.SelectedValue == "0") //{ // LblMsg.Text = "Select Project Ledger...."; // DDLPrjLed.Focus(); // return; //} //if (DDLPrjName.SelectedValue == "0") //{ // LblMsg.Text = "Select Project Name...."; // DDLPrjName.Focus(); // return; //} //if (DDLPrjModule.SelectedValue == "0") //{ // LblMsg.Text = "Select Project Module...."; // DDLPrjModule.Focus(); // return; //} //if (ddlEmployee.SelectedValue == "0") //{ // LblMsg.Text = "Select Employee Name...."; // ddlEmployee.Focus(); // return; //} //if (TxtAssignDate.Text.Length == 0) //{ // LblMsg.Text = "Assign Date Is Blank, Enter Valid Date...."; // TxtAssignDate.Focus(); // return; //} //if (int.Parse(TxtDueDays.Text) == 0) //{ // LblMsg.Text = "Due Days Is Zero, Enter Valid Days...."; // TxtDueDays.Focus(); // return; //} //if (TxtWrkDetails1.Text.Length == 0) //{ // LblMsg.Text = "Enter Working Details...."; // TxtWrkDetails1.Focus(); // return; //} //if (ddlWrkStatus.SelectedValue == "0") //{ // LblMsg.Text = "Select Work Status...."; // ddlWrkStatus.Focus(); // return; //} StrSql = new StringBuilder(); StrSql.Length = 0; if (HidFldId.Value.Length == 0) { StrSql.AppendLine("Insert Into WorkAssDet(PrjLedId,PrjId,PrjModId,ClientName,EmpId"); StrSql.AppendLine(",AssignDate,AssignTime,DueDate,DueDays"); StrSql.AppendLine(",WorkDet1,WorkDet2,WorkDet3,WorkStatus"); StrSql.AppendLine(",CompleteDate,CompleteTime,Remark"); StrSql.AppendLine(",Entry_Date,Entry_Time,Entry_UID,UPDFLAG)"); StrSql.AppendLine("Values(@PrjLedId,@PrjId,@PrjModId,@ClientName,@EmpId"); StrSql.AppendLine(",@AssignDate,@AssignTime,@DueDate,@DueDays"); StrSql.AppendLine(",@WorkDet1,@WorkDet2,@WorkDet3,@WorkStatus"); StrSql.AppendLine(",@CompleteDate,@CompleteTime,@Remark"); StrSql.AppendLine(",GETDATE(),CONVERT(VarChar,GetDate(),108),@Entry_UID,0)"); } else { StrSql.AppendLine("Update WorkAssDet"); StrSql.AppendLine("Set PrjLedId=@PrjLedId"); StrSql.AppendLine(",PrjId=@PrjId"); StrSql.AppendLine(",PrjModId=@PrjModId"); StrSql.AppendLine(",ClientName=@ClientName"); StrSql.AppendLine(",EmpId=@EmpId"); StrSql.AppendLine(",AssignDate=@AssignDate"); StrSql.AppendLine(",AssignTime=@AssignTime"); StrSql.AppendLine(",DueDate=@DueDate"); StrSql.AppendLine(",DueDays=@DueDays"); StrSql.AppendLine(",WorkDet1=@WorkDet1"); StrSql.AppendLine(",WorkDet2=@WorkDet2"); StrSql.AppendLine(",WorkDet3=@WorkDet3"); StrSql.AppendLine(",WorkStatus=@WorkStatus"); StrSql.AppendLine(",CompleteDate=@CompleteDate"); StrSql.AppendLine(",CompleteTime=@CompleteTime"); StrSql.AppendLine(",Remark=@Remark"); StrSql.AppendLine(",MEntry_Date=GetDate(),MEntry_Time=Convert(Varchar,GetDate(),108)"); StrSql.AppendLine(",MEntry_UID=@Entry_UID"); StrSql.AppendLine(",UPDFLAG=IsNull(UPDFlag,0)+1"); StrSql.AppendLine("Where Id=@Id"); } Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); Cmd.Parameters.AddWithValue("@PrjLedId", DDLPrjLed.SelectedValue); Cmd.Parameters.AddWithValue("@PrjId", DDLPrjName.SelectedValue); Cmd.Parameters.AddWithValue("@PrjModId", DDLPrjModule.SelectedValue); Cmd.Parameters.AddWithValue("@ClientName", TxtClientName.Text); Cmd.Parameters.AddWithValue("@EmpId", ddlEmployee.SelectedValue); Cmd.Parameters.AddWithValue("@AssignDate", ValueConvert.ConvertDate(TxtAssignDate.Text)); Cmd.Parameters.AddWithValue("@AssignTime", TxtAssignTime.Text); Cmd.Parameters.AddWithValue("@DueDate", ValueConvert.ConvertDate(TxtDueDate.Text)); Cmd.Parameters.AddWithValue("@DueDays", TxtDueDays.Text); Cmd.Parameters.AddWithValue("@WorkDet1", TxtWrkDetails1.Text); Cmd.Parameters.AddWithValue("@WorkDet2", TxtWrkDetails2.Text); Cmd.Parameters.AddWithValue("@WorkDet3", TxtWrkDetails3.Text); Cmd.Parameters.AddWithValue("@WorkStatus", ddlWrkStatus.SelectedValue); if (TxtCompleteDate.Text.Length != 0) { Cmd.Parameters.AddWithValue("@CompleteDate", ValueConvert.ConvertDate(TxtCompleteDate.Text)); } else { Cmd.Parameters.AddWithValue("@CompleteDate", DBNull.Value); } Cmd.Parameters.AddWithValue("@CompleteTime", TxtCompleteTime.Text); Cmd.Parameters.AddWithValue("@Remark", TxtRemark.Text); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); if (HidFldId.Value.Length == 0) { SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry added successfully"; } else { Cmd.Parameters.AddWithValue("@ID", HidFldId.Value.ToString()); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry updated successfully"; } FillGrid(); ClearAll(); // Move to View Tab MyMenu.Items[0].Selected = true; MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; MyMultiView.ActiveViewIndex = 0; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; } catch (Exception ex) { Response.Write(ex); } }
protected void BtnShow_Click(object sender, EventArgs e) { try { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("EmpInfoRV.rdlc"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select E.EmpName,E.EmpGroup"); StrSql.AppendLine(",D.DeptName,Ds.DesigName "); StrSql.AppendLine(",CONVERT(VarChar(10),E.DOJ,103) As DOJ"); StrSql.AppendLine(",IsNull(E.BasicRate,0) As BasicRate"); StrSql.AppendLine(",CONVERT(VarChar(10),E.DOB,103) As DOB"); StrSql.AppendLine(",Case When IsNull(E.Gender,'') ='M' Then 'Male'"); StrSql.AppendLine(" When IsNull(E.Gender,'') ='F' Then 'Female' Else '' End As Gender"); StrSql.AppendLine(",E.EMailId"); StrSql.AppendLine(",C.CountryName,S.StateName,Ci.CityName"); StrSql.AppendLine(",E.Address1,E.PinCode,E.MobNo,E.Phone,E.BloodGroup"); StrSql.AppendLine(",Convert(VarChar(10),E.LeftDate,103) As LeftDate"); StrSql.AppendLine(",E.FJobTime,E.TJobTime,E.TotTime"); StrSql.AppendLine("From Emp_Mast E"); StrSql.AppendLine("Left Join Dept_Mast D On D.Id=E.DeptId"); StrSql.AppendLine("Left Join Desig_Mast Ds On Ds.Id=E.DesigId"); StrSql.AppendLine("Left Join Country_Mast C On C.Id=E.CountryId"); StrSql.AppendLine("Left Join State_Mast S On S.Id=E.StateId"); StrSql.AppendLine("Left Join City_Mast Ci On Ci.Id=E.CityId"); StrSql.AppendLine("Where 1=1"); if (ddlEmployee.SelectedValue != "0") { StrSql.AppendLine("And E.Id=" + int.Parse(ddlEmployee.SelectedValue.ToString())); } if (DDLEmpGroup.SelectedValue != "0") { StrSql.AppendLine("And IsNull(E.EmpGroup,'')='" + DDLEmpGroup.SelectedValue.ToString() + "'"); } if (ddlBloodGrp.SelectedValue != "0") { StrSql.AppendLine("And IsNull(E.BloodGroup,'')='" + ddlBloodGrp.SelectedValue.ToString() + "'"); } if (DDLDeptName.SelectedValue != "0") { StrSql.AppendLine("And E.DeptId=" + int.Parse(DDLDeptName.SelectedValue.ToString())); } if (DDLDesignation.SelectedValue != "0") { StrSql.AppendLine("And E.DesigId=" + int.Parse(DDLDesignation.SelectedValue.ToString())); } if (rblGender.SelectedValue != "A") { StrSql.AppendLine("And IsNull(E.Gender,'')='" + rblGender.SelectedValue + "'"); } if (TxtFDOJ.Text.Trim() != "") { StrSql.AppendLine("And E.DOJ >='" + ValueConvert.ConvertDate(TxtFDOJ.Text.Trim()) + "'"); } if (TxtTDOJ.Text.Trim() != "") { StrSql.AppendLine("And E.DOJ <='" + ValueConvert.ConvertDate(TxtTDOJ.Text.Trim()) + "'"); } if (TxtFDOB.Text.Trim() != "") { StrSql.AppendLine("And E.DOB >='" + ValueConvert.ConvertDate(TxtFDOB.Text.Trim()) + "'"); } if (TxtTDOB.Text.Trim() != "") { StrSql.AppendLine("And E.DOB <='" + ValueConvert.ConvertDate(TxtTDOB.Text.Trim()) + "'"); } if (TxtFLeftDate.Text.Trim() != "") { StrSql.AppendLine("And E.LeftDate >='" + ValueConvert.ConvertDate(TxtFLeftDate.Text.Trim()) + "'"); } if (TxtTLeftDate.Text.Trim() != "") { StrSql.AppendLine("And E.LeftDate <='" + ValueConvert.ConvertDate(TxtTLeftDate.Text.Trim()) + "'"); } if (ddlCountry.SelectedValue != "0") { StrSql.AppendLine("And E.CountryId=" + int.Parse(ddlCountry.SelectedValue.ToString())); } if (ddlState.SelectedValue != "0") { StrSql.AppendLine("And E.StateId=" + int.Parse(ddlState.SelectedValue.ToString())); } if (ddlCity.SelectedValue != "0") { StrSql.AppendLine("And E.CityId=" + int.Parse(ddlCity.SelectedValue.ToString())); } StrSql.AppendLine("Order By E.EmpName "); HRMDataSet dsAssWorkInfo = ComFunc.GetData(StrSql.ToString().Replace("\r\n", " "), "EmpInfo"); ReportDataSource WorkDataSource = new ReportDataSource("EmpInfo", dsAssWorkInfo.Tables["EmpInfo"]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(WorkDataSource); } catch { Response.Redirect("~/ErrorPage.aspx"); } }
public XmlElement GetWorkList(int pIntPrjLedId, int pIntEmpId, int pIntPrjId, int pIntPrjModId , string pStrAssignDate, string pStrWorkStatus, string pStrDueDate) { try { StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select PL.EmpName As [Project Ledger]" + Environment.NewLine); StrSql.AppendLine(" ,P.ProjectName As Project" + Environment.NewLine); StrSql.AppendLine(" ,M.ModuleName As Module" + Environment.NewLine); StrSql.AppendLine(" ,CM.ClientName As Client" + Environment.NewLine); StrSql.AppendLine(" ,E.EmpName As Employee" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.AssignDate,103) As [Assign Date]" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.AssignTime,108) As [Assign Time]" + Environment.NewLine); StrSql.AppendLine(" ,IsNull(W.DueDays,0) As [Due Days]" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.DueDate,103) As [Due Date]" + Environment.NewLine); StrSql.AppendLine(" ,W.WorkDet1 As [Work 1]" + Environment.NewLine); StrSql.AppendLine(" ,W.WorkDet2 As [Work 2]" + Environment.NewLine); StrSql.AppendLine(" ,W.WorkDet3 As [Work 3]" + Environment.NewLine); StrSql.AppendLine(" ,Case When IsNull(W.WorkStatus,'')='D' Then 'Done'" + Environment.NewLine); StrSql.AppendLine(" When IsNull(W.WorkStatus,'')='P' Then 'Pending'" + Environment.NewLine); StrSql.AppendLine(" When IsNull(W.WorkStatus,'')='C' Then 'Cancle'" + Environment.NewLine); StrSql.AppendLine(" Else '' End As [Work Status]" + Environment.NewLine); StrSql.AppendLine(" ,W.Remark" + Environment.NewLine); StrSql.AppendLine(" ,Case When IsNull(W.CompleteDate,'')<>''" + Environment.NewLine); StrSql.AppendLine(" Then Convert(Varchar(10),W.CompleteDate,103) Else '' End As [Complete Date]" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.CompleteTime,108) As [Complete Time]" + Environment.NewLine); StrSql.AppendLine(" From WorkAssDet W" + Environment.NewLine); StrSql.AppendLine(" Left Join Emp_Mast PL On PL.Id=W.PrjLedId " + Environment.NewLine); StrSql.AppendLine(" Left Join Project_Mast P On P.Id=W.PrjId" + Environment.NewLine); StrSql.AppendLine(" Left Join Project_Module M On M.Id=W.PrjModId" + Environment.NewLine); StrSql.AppendLine(" Left Join Client_Mast CM On CM.Id=P.ClientId" + Environment.NewLine); StrSql.AppendLine(" Left Join Emp_Mast E On E.Id=W.EmpId" + Environment.NewLine); StrSql.AppendLine(" Where 1=1 " + Environment.NewLine); if (pIntPrjLedId != 0) { StrSql.AppendLine("And W.PrjLedId=" + pIntPrjLedId + Environment.NewLine); } if (pIntEmpId != 0) { StrSql.AppendLine("And W.EmpId=" + pIntEmpId + Environment.NewLine); } if (pIntPrjId != 0) { StrSql.AppendLine("And W.PrjId=" + pIntPrjId + Environment.NewLine); } if (pIntPrjModId != 0) { StrSql.AppendLine("And W.PrjModId=" + pIntPrjModId + Environment.NewLine); } if (pStrAssignDate != "") { StrSql.AppendLine("And W.AssignDate ='" + ValueConvert.ConvertDate(pStrAssignDate) + "'" + Environment.NewLine); } if (pStrWorkStatus != "0") { StrSql.AppendLine("And W.WorkStatus='" + pStrWorkStatus + "'" + Environment.NewLine); } if (pStrDueDate != "") { StrSql.AppendLine("And W.DueDate ='" + ValueConvert.ConvertDate(pStrDueDate) + "'" + Environment.NewLine); } StrSql.AppendLine(" Order By PL.EmpName,P.ProjectName,M.ModuleName,E.EmpName" + Environment.NewLine); ds = new DataSet(); ds = SqlFunc.ExecuteDataSet(StrSql.ToString().Replace("\r\n", " ")); //return the dataset as an xmlelement. XmlDataDocument xmldata = new XmlDataDocument(ds); XmlElement xmlElement = xmldata.DocumentElement; return(xmlElement); } catch (Exception ex) { throw ex; } }
protected void BtnSave_Click(object sender, EventArgs e) { try { StrSql = new StringBuilder(); StrSql.Length = 0; if (HidFldId.Value.Length == 0) { StrSql.AppendLine("Insert Into DRFH"); StrSql.AppendLine("(DRFDate,EmpId"); StrSql.AppendLine(",InTime,OutTime"); StrSql.AppendLine(",TotTime,Remark"); StrSql.AppendLine(",Entry_Date,Entry_Time"); StrSql.AppendLine(",Entry_UID,UPDFLAG)"); StrSql.AppendLine("Values"); StrSql.AppendLine("(@DRFDate,@EmpId"); StrSql.AppendLine(",@InTime,@OutTime"); StrSql.AppendLine(",@TotTime,@Remark"); StrSql.AppendLine(",GetDate(),CONVERT(Varchar,GETDATE(),108)"); StrSql.AppendLine(",@Entry_UID,0)"); } else { StrSql.AppendLine("Update DRFH"); StrSql.AppendLine("Set DRFDate=@DRFDate"); StrSql.AppendLine(",EmpId=@EmpId"); StrSql.AppendLine(",InTime=@InTime"); StrSql.AppendLine(",OutTime=@OutTime"); StrSql.AppendLine(",TotTime=@TotTime"); StrSql.AppendLine(",Remark=@Remark"); StrSql.AppendLine(",UPDFLAG=ISNULL(UPDFLAG,0)+1"); StrSql.AppendLine(",MEntry_Date=GETDATE()"); StrSql.AppendLine(",MEntry_Time=CONVERT(Varchar,GETDATE(),108)"); StrSql.AppendLine(",MEntry_UID=@Entry_UId"); StrSql.AppendLine("Where Id=@Id"); } Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); Cmd.Parameters.AddWithValue("@DRFDate", ValueConvert.ConvertDate(TxtDRFDate.Text)); Cmd.Parameters.AddWithValue("@EmpId", DDLEmplName.SelectedValue); Cmd.Parameters.AddWithValue("@InTime", TxtInTime.Text); Cmd.Parameters.AddWithValue("@OutTime", TxtOutTime.Text); Cmd.Parameters.AddWithValue("@TotTime", TxtTotWrkHours.Text); Cmd.Parameters.AddWithValue("@Remark", TxtRemark.Text); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); if (HidFldId.Value.Length == 0) { SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry insert successfully..."; } else { Cmd.Parameters.AddWithValue("@Id", int.Parse(HidFldId.Value)); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry update successfully..."; } FillGrid(); ClearAll(); MyMenu.Items[0].Selected = true; MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; MyMultiView.ActiveViewIndex = 0; } catch (Exception ex) { Response.Write(ex.ToString()); } }
//protected void GridInOut_SelectedIndexChanged(object sender, EventArgs e) //{ // try // { // HidFldId.Value = GridInOut.DataKeys[GridInOut.SelectedRow.RowIndex].Value.ToString(); // StrSql = new StringBuilder(); // StrSql.Length = 0; // StrSql = new StringBuilder(); // StrSql.Length = 0; // StrSql.AppendLine("Select D.Id,D.EmpId"); // StrSql.AppendLine(",D.OffiFTime,D.OffiTTime,D.OffiHours"); // StrSql.AppendLine(",Convert(Varchar(10),D.Working_Date,103) As Working_Date,D.Working_Days,D.Working_Month"); // StrSql.AppendLine(",D.InTime,D.OutTime,D.TotWork_Hours"); // StrSql.AppendLine(",D.OverTime,D.LessTime"); // StrSql.AppendLine(",D.Reason,D.Remark"); // StrSql.AppendLine("From DailyAttendance D"); // StrSql.AppendLine("Where D.Id=" + int.Parse(HidFldId.Value)); // dtTemp = new DataTable(); // dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); // if (dtTemp.Rows.Count == 0) // { // LblMsg.Text = "Data not found"; // return; // } // ddlEmployee.Items.Clear(); // ddlEmployee.DataSource = BLayer.FillEmp(""); // ddlEmployee.DataValueField = "EmpId"; // ddlEmployee.DataTextField = "EmpName"; // ddlEmployee.DataBind(); // ddlEmployee.Items.Insert(0, new ListItem("--Select Employee--", "0")); // if (dtTemp.Rows[0]["EmpId"].ToString() != "") // { // ddlEmployee.SelectedValue = dtTemp.Rows[0]["EmpId"].ToString(); // } // TxtOffFTime.Text = dtTemp.Rows[0]["OffiFTime"].ToString(); // TxtOffTTime.Text = dtTemp.Rows[0]["OffiTTime"].ToString(); // TxtOffHours.Text = dtTemp.Rows[0]["OffiHours"].ToString(); // TxtDate.Text = dtTemp.Rows[0]["Working_Date"].ToString(); // TxtDays.Text = dtTemp.Rows[0]["Working_Days"].ToString(); // TxtMonth.Text = dtTemp.Rows[0]["Working_Month"].ToString(); // TxtInTime.Text = dtTemp.Rows[0]["InTime"].ToString(); // TxtOutTime.Text = dtTemp.Rows[0]["OutTime"].ToString(); // TxtTotWrkHours.Text = dtTemp.Rows[0]["TotWork_Hours"].ToString(); // TxtOverTime.Text = dtTemp.Rows[0]["OverTime"].ToString(); // TxtLessTime.Text = dtTemp.Rows[0]["LessTime"].ToString(); // TxtReason.Text = dtTemp.Rows[0]["Reason"].ToString(); // TxtRemark.Text = dtTemp.Rows[0]["Remark"].ToString(); // ddlEmployee.Enabled = false; // // Move to Edit Tab // MyMenu.Items[0].ImageUrl = "~/Images/ViewDisable.jpg"; // MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditEnable.jpg"; // MyMenu.Items[1].Selected = true; // MyMultiView.ActiveViewIndex = 1; // } // catch (Exception ex) // { // Response.Write(ex.ToString()); // } //} protected void BtnSave_Click(object sender, EventArgs e) { try { if (ddlEmployee.SelectedValue == "0") { //LblMsg.Text = "Employee Name Is Blank, Enter Valid Name...."; ddlEmployee.Focus(); return; } if (TxtDate.Text.Length == 0) { //LblMsg.Text = "Date Is Blank, Enter Valid Date...."; TxtDate.Focus(); return; } if (TxtInTime.Text.Length == 0) { //LblMsg.Text = "In Time Is Blank, Enter Valid Time...."; TxtInTime.Focus(); return; } string[] TotWrkHours = TxtTotWrkHours.Text.Split('.'); int WrkH = ValueConvert.ValInt16(TotWrkHours[0].ToString()); if (WrkH < 5 && TxtReason.Text.Length == 0) { LblMsg.Text = "Give Valid Reason, Because Working Hours Is Less Then 5.00..."; TxtReason.Focus(); return; } LblMsg.Text = ""; StrSql = new StringBuilder(); StrSql.Length = 0; if (HidFldId.Value.Length == 0) { StrSql.AppendLine("Insert Into DailyAttendance"); StrSql.AppendLine("(EmpId"); StrSql.AppendLine(",OffiFTime"); StrSql.AppendLine(",OffiTTime"); StrSql.AppendLine(",OffiHours"); StrSql.AppendLine(",Working_Date"); StrSql.AppendLine(",Working_Days"); StrSql.AppendLine(",Working_Month"); StrSql.AppendLine(",InTime"); StrSql.AppendLine(",OutTime"); StrSql.AppendLine(",TotWork_Hours"); StrSql.AppendLine(",OverTime"); StrSql.AppendLine(",LessTime"); StrSql.AppendLine(",Reason"); StrSql.AppendLine(",Remark"); StrSql.AppendLine(",Entry_Date"); StrSql.AppendLine(",Entry_Time"); StrSql.AppendLine(",Entry_UID"); StrSql.AppendLine(",UPDFLAG"); StrSql.AppendLine(")"); StrSql.AppendLine("Values"); StrSql.AppendLine("(@EmpId"); StrSql.AppendLine(",@OffiFTime"); StrSql.AppendLine(",@OffiTTime"); StrSql.AppendLine(",@OffiHours"); StrSql.AppendLine(",@Working_Date"); StrSql.AppendLine(",@Working_Days"); StrSql.AppendLine(",@Working_Month"); StrSql.AppendLine(",@InTime"); StrSql.AppendLine(",@OutTime"); StrSql.AppendLine(",@TotWork_Hours"); StrSql.AppendLine(",@OverTime"); StrSql.AppendLine(",@LessTime"); StrSql.AppendLine(",@Reason"); StrSql.AppendLine(",@Remark"); StrSql.AppendLine(",GetDate()"); StrSql.AppendLine(",Convert(VarChar,GetDate(),108)"); StrSql.AppendLine(",@Entry_UID"); StrSql.AppendLine(",0"); StrSql.AppendLine(")"); } else { StrSql.AppendLine("Update DailyAttendance"); StrSql.AppendLine("Set OffiFTime=@OffiFTime"); StrSql.AppendLine(",OffiTTime=@OffiTTime"); StrSql.AppendLine(",OffiHours=@OffiHours"); StrSql.AppendLine(",Working_Date=@Working_Date"); StrSql.AppendLine(",Working_Days=@Working_Days"); StrSql.AppendLine(",Working_Month=@Working_Month"); StrSql.AppendLine(",InTime=@InTime"); StrSql.AppendLine(",OutTime=@OutTime"); StrSql.AppendLine(",TotWork_Hours=@TotWork_Hours"); StrSql.AppendLine(",OverTime=@OverTime"); StrSql.AppendLine(",LessTime=@LessTime"); StrSql.AppendLine(",Reason=@Reason"); StrSql.AppendLine(",Remark=@Remark"); StrSql.AppendLine(",MEntry_Date=GetDate(),MEntry_Time=Convert(Varchar,GetDate(),108)"); StrSql.AppendLine(",MEntry_UID=@Entry_UID"); StrSql.AppendLine(",UPDFLAG=IsNull(UPDFlag,0)+1"); StrSql.AppendLine("Where Id=@Id And EmpId=@EmpId"); } Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); if (ddlEmployee.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@EmpId", ddlEmployee.SelectedValue); } else { Cmd.Parameters.AddWithValue("@EmpId", DBNull.Value); } Cmd.Parameters.AddWithValue("@OffiFTime", TxtOffFTime.Text); Cmd.Parameters.AddWithValue("@OffiTTime", TxtOffTTime.Text); Cmd.Parameters.AddWithValue("@OffiHours", TxtOffHours.Text); if (TxtDate.Text.Length != 0) { Cmd.Parameters.AddWithValue("@Working_Date", ValueConvert.ConvertDate(TxtDate.Text)); } else { Cmd.Parameters.AddWithValue("@Working_Date", DBNull.Value); } Cmd.Parameters.AddWithValue("@Working_Days", TxtDays.Text); Cmd.Parameters.AddWithValue("@Working_Month", TxtMonth.Text); Cmd.Parameters.AddWithValue("@InTime", TxtInTime.Text); Cmd.Parameters.AddWithValue("@OutTime", TxtOutTime.Text); Cmd.Parameters.AddWithValue("@TotWork_Hours", TxtTotWrkHours.Text); Cmd.Parameters.AddWithValue("@OverTime", TxtOverTime.Text); Cmd.Parameters.AddWithValue("@LessTime", TxtLessTime.Text); Cmd.Parameters.AddWithValue("@Reason", TxtReason.Text); Cmd.Parameters.AddWithValue("@Remark", TxtRemark.Text); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); if (HidFldId.Value.Length == 0) { SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry added successfully"; } else { Cmd.Parameters.AddWithValue("@ID", HidFldId.Value.ToString()); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Entry updated successfully"; } FillGrid(); ClearAll(); //// Move to View Tab //MyMenu.Items[0].Selected = true; //MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; //MyMultiView.ActiveViewIndex = 0; //MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; ddlEmployee.Focus(); } catch (Exception ex) { Response.Write(ex); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (TxtUserId.Text.Length == 0) { // LblMsg.Text = "User Id Is Blank, Enter Valid User Id...."; TxtUserId.Focus(); return; } if (TxtUserName.Text.Length == 0) { // LblMsg.Text = "User Name Is Blank, Enter Valid User Name...."; TxtUserName.Focus(); return; } if (TxtLoginName.Text.Length == 0) { //LblMsg.Text = "Login Name Is Blank, Enter Valid Login Name...."; TxtLoginName.Focus(); return; } if (DDLUserGroup.SelectedValue == "0") { //LblMsg.Text = "Select User Group...."; DDLUserGroup.Focus(); return; } if (TxtDOB.Text.Length == 0) { //LblMsg.Text = "DOB Is Blank, Enter Valid Brith Date...."; TxtDOB.Focus(); return; } if (TxtEMailId.Text.Length == 0) { //LblMsg.Text = "EMail Id Is Blank, Enter Valid EMail Id...."; TxtEMailId.Focus(); return; } if (TxtMobNo.Text.Length == 0) { //LblMsg.Text = "Mob.No Is Blank, Enter Valid Mob.No...."; TxtMobNo.Focus(); return; } if (TxtPassword.Text.Length == 0) { //LblMsg.Text = "Password Is Blank, Enter Valid Password...."; TxtPassword.Focus(); return; } if (TxtQuestion.Text.Length == 0) { //LblMsg.Text = "Question Is Blank, Enter Valid Question...."; TxtQuestion.Focus(); return; } if (TxtAnswer.Text.Length == 0) { //LblMsg.Text = "Answer Is Blank, Enter Valid Answer...."; TxtAnswer.Focus(); return; } StrSql = new StringBuilder(); StrSql.Length = 0; if (HidFldId.Value.Length == 0) { StrSql.AppendLine("Insert Into User_Mast (UId,UserName,LoginName"); StrSql.AppendLine(",UserGroup,Password "); StrSql.AppendLine(",Gender,EMailId,DOB"); StrSql.AppendLine(",CountryId,StateId,CityId"); StrSql.AppendLine(",MobNo,Phone"); StrSql.AppendLine(",Question,Answer"); StrSql.AppendLine(",Activation"); StrSql.AppendLine(",Entry_Date,Entry_Time"); StrSql.AppendLine(",Entry_UID,UPDFLAG)"); StrSql.AppendLine("Values(@UserId,@UserName,@LoginName"); StrSql.AppendLine(",@UserGroup,@Password "); StrSql.AppendLine(",@Gender,@EMailId,@DOB"); StrSql.AppendLine(",@CountryId,@StateId,@CityId"); StrSql.AppendLine(",@MobNo,@Phone"); StrSql.AppendLine(",@Question,@Answer"); StrSql.AppendLine(",@Activation"); StrSql.AppendLine(",GetDate(),Convert(VarChar,GetDate(),108)"); StrSql.AppendLine(",@Entry_UID,0)"); } else { StrSql.AppendLine("Update User_Mast Set UId=@UserId,UserName=@UserName,LoginName=@LoginName"); StrSql.AppendLine(",UserGroup=@UserGroup,Password=@Password "); StrSql.AppendLine(",Gender=@Gender,EMailId=@EMailId,DOB=@DOB"); StrSql.AppendLine(",CountryId=@CountryId,StateId=@StateId,CityId=@CityId"); StrSql.AppendLine(",MobNo=@MobNo,Phone=@Phone"); StrSql.AppendLine(",Question=@Question,Answer=@Answer"); StrSql.AppendLine(",Activation=@Activation"); StrSql.AppendLine(",MEntry_Date=GetDate(),MEntry_Time=Convert(Varchar,GetDate(),108)"); StrSql.AppendLine(",MEntry_UID=@Entry_UID,UPDFLAG=IsNull(UPDFlag,0)+1"); StrSql.AppendLine("Where Id=@Id"); } Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); Cmd.Parameters.AddWithValue("@UserId", TxtUserId.Text.Trim()); Cmd.Parameters.AddWithValue("@UserName", TxtUserName.Text.Trim()); Cmd.Parameters.AddWithValue("@LoginName", TxtLoginName.Text.Trim()); Cmd.Parameters.AddWithValue("@UserGroup", DDLUserGroup.SelectedValue); Cmd.Parameters.AddWithValue("@Password", Sec.Encrypt(TxtPassword.Text.Trim())); Cmd.Parameters.AddWithValue("@Gender", rblGender.SelectedValue); Cmd.Parameters.AddWithValue("@EMailId", TxtEMailId.Text.Trim()); Cmd.Parameters.AddWithValue("@DOB", ValueConvert.ConvertDate(TxtDOB.Text)); if (ddlCountry.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@CountryId", ddlCountry.SelectedValue); } else { Cmd.Parameters.AddWithValue("@CountryId", DBNull.Value); } if (ddlState.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@StateId", ddlState.SelectedValue); } else { Cmd.Parameters.AddWithValue("@StateId", DBNull.Value); } if (ddlCity.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@CityId", ddlCity.SelectedValue); } else { Cmd.Parameters.AddWithValue("@CityId", DBNull.Value); } Cmd.Parameters.AddWithValue("@MobNo", TxtMobNo.Text.Trim()); Cmd.Parameters.AddWithValue("@Phone", TxtPhone.Text.Trim()); Cmd.Parameters.AddWithValue("@Question", TxtQuestion.Text.Trim()); Cmd.Parameters.AddWithValue("@Answer", TxtAnswer.Text.Trim()); Cmd.Parameters.AddWithValue("@Activation", 0); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); if (HidFldId.Value.Length == 0) { SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "User added successfully"; } else { Cmd.Parameters.AddWithValue("@ID", HidFldId.Value.ToString()); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "User updated successfully"; } FillGrid(); ClearAll(); MyMenu.Items[0].Selected = true; MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; MyMultiView.ActiveViewIndex = 0; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; } catch (Exception ex) { Response.Write(ex); } }
protected void BtnGenSal_Click(object sender, EventArgs e) { try { //if (ddlmonth.SelectedValue.ToString() == "0") //{ // LblMsg.Text = "Select Month !!!"; // ddlmonth.Focus(); // return; //} //if (ddlyear.SelectedValue.ToString() == "0") //{ // LblMsg.Text = "Select Year !!!"; // ddlyear.Focus(); // return; //} string FDate, TDate; FDate = ValueConvert.ConvertDate(TxtFDate.Text.ToString()); TDate = ValueConvert.ConvertDate(TxtTDate.Text.ToString()); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select D.EmpId,E.EmpName,D.Working_Month,E.BasicRate"); StrSql.AppendLine(",(ISNULL(E.BasicRate,0) / 30) As PerDay_Salary"); StrSql.AppendLine(",((ISNULL(E.BasicRate,0) / 30) / ISNULL(E.TotTime,0)) As PerHours_Salary"); StrSql.AppendLine(""); StrSql.AppendLine(",DateDiff(dd,DateAdd(dd, 1-Day('" + FDate + "'),'" + FDate + "'),dateadd(m,1,dateadd(dd, 1-day('" + FDate + "'),'" + FDate + "'))) Month_Days"); StrSql.AppendLine(",DATEDIFF(wk, '" + FDate + "', '" + TDate + "') As Sunday"); StrSql.AppendLine(",Count(1) As Present"); StrSql.AppendLine(",DateDiff(dd,DateAdd(dd, 1-Day('" + FDate + "'),'" + FDate + "'),dateadd(m,1,dateadd(dd, 1-day('" + FDate + "'),'" + FDate + "'))) -"); StrSql.AppendLine(" (DATEDIFF(wk, '" + FDate + "', '" + TDate + "')+(Count(1))) As Absent"); StrSql.AppendLine(",(Count(1)) * (Round((ISNULL(E.BasicRate,0) / 30),0)) As Give_Salary"); StrSql.AppendLine(",((DateDiff(dd,DateAdd(dd, 1-Day('" + FDate + "'),'" + FDate + "'),dateadd(m,1,dateadd(dd, 1-day('" + FDate + "'),'" + FDate + "')))) -"); StrSql.AppendLine(" (DATEDIFF(wk, '" + FDate + "', '" + TDate + "')+(Count(1)))) * Round((ISNULL(E.BasicRate,0) / 30),0) As Cut_Salary"); StrSql.AppendLine(""); StrSql.AppendLine(",E.TotTime As JobTime"); StrSql.AppendLine(",((DateDiff(dd,DateAdd(dd, 1-Day('" + FDate + "'),'" + FDate + "'),dateadd(m,1,dateadd(dd, 1-day('" + FDate + "'),'" + FDate + "'))) -"); StrSql.AppendLine(" DATEDIFF(wk, '" + FDate + "', '" + TDate + "')) * IsNull(D.OffiHours,0)) As TotHours"); StrSql.AppendLine(",SUM(IsNull(D.TotWork_Hours,0)) As WorkHours"); StrSql.AppendLine(",SUM(IsNull(D.OverTime,0)) As OverTime"); StrSql.AppendLine(",SUM(IsNull(D.LessTime,0)) As LessTime"); StrSql.AppendLine(",SUM(IsNull(D.OverTime,0))-SUM(IsNull(D.LessTime,0)) As ExtraOrCut"); StrSql.AppendLine(""); StrSql.AppendLine(",(ISNULL(E.BasicRate,0) / 30) / ISNULL(E.TotTime,0) * "); StrSql.AppendLine(" SUM(IsNull(D.TotWork_Hours,0)) As WorkSalary"); StrSql.AppendLine(",(ISNULL(E.BasicRate,0) / 30) / ISNULL(E.TotTime,0) * "); StrSql.AppendLine(" (SUM(IsNull(D.OverTime,0))-SUM(IsNull(D.LessTime,0))) As ExtraOrCutSalary"); StrSql.AppendLine(""); StrSql.AppendLine("From DailyAttendance D"); StrSql.AppendLine("Left Join Emp_Mast E On D.EmpId=E.Id"); StrSql.AppendLine(""); StrSql.AppendLine("Where D.Working_Month='" + ddlmonth.SelectedItem.Text.ToString() + "'"); StrSql.AppendLine("And DATEPART(YY,D.Working_Date)='" + int.Parse(ddlyear.SelectedValue) + "'"); StrSql.AppendLine("And Cast(D.Working_Month As VarChar(25))+' '+Cast(DATEPART(YY,D.Working_Date) As VarChar(25))+' '+Cast(D.EmpId As VarChar(10))"); StrSql.AppendLine(" Not In (Select Cast(MMonth As VarChar(25))+' '+Cast(MYear As VarChar(25))+' '+Cast(EmpId As VarChar(10)) From MthSallary)"); if (ddlEmployee.SelectedValue.ToString() != "0") { StrSql.AppendLine("And D.EmpId In (" + int.Parse(ddlEmployee.SelectedValue) + ")"); } StrSql.AppendLine(""); StrSql.AppendLine("Group By D.EmpId,E.EmpName,E.BasicRate,E.TotTime,D.Working_Month"); StrSql.AppendLine(",IsNull(D.OffiHours,0)"); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString().Replace("\r\n", " ")); if (dtTemp.Rows.Count != 0) { SqlFunc.BeginConnWithTransaction(); int i; for (i = 0; i <= dtTemp.Rows.Count - 1; i++) { int IntNewTransId = 0; StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select IsNull(Max(IsNull(TransactionId,0)),0) + 1 As TransId From MthSallary "); DataTable dtTrnId = SqlFunc.ExecuteTransTable(StrSql.ToString().Replace("\r\n", " ")); if (dtTrnId.Rows.Count != 0) { IntNewTransId = Convert.ToInt16(dtTrnId.Rows[0]["TransId"].ToString()); } StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Insert Into MthSallary("); StrSql.AppendLine("TransactionId"); StrSql.AppendLine(",EmpId"); StrSql.AppendLine(",MMonth"); StrSql.AppendLine(",MYear"); StrSql.AppendLine(",FromDate"); StrSql.AppendLine(",ToDate"); StrSql.AppendLine(",MthDays"); StrSql.AppendLine(",WOffDays"); StrSql.AppendLine(",Present"); StrSql.AppendLine(",Absent"); StrSql.AppendLine(",JobTime"); StrSql.AppendLine(",TotHours"); StrSql.AppendLine(",WorkHours"); StrSql.AppendLine(",OverTime"); StrSql.AppendLine(",LessTime"); StrSql.AppendLine(",ExtraOrCut"); StrSql.AppendLine(",BasicRate"); StrSql.AppendLine(",PerDaySal"); StrSql.AppendLine(",PerHourSal"); StrSql.AppendLine(",CutSal"); StrSql.AppendLine(",GiveSal"); StrSql.AppendLine(",WorkSal"); StrSql.AppendLine(",ExtraOrCutSal"); StrSql.AppendLine(",Entry_Date,Entry_Time,Entry_UID,UPDFLAG"); StrSql.AppendLine(")"); StrSql.AppendLine("Values("); StrSql.AppendLine("@TransactionId"); StrSql.AppendLine(",@EmpId"); StrSql.AppendLine(",@MMonth"); StrSql.AppendLine(",@MYear"); StrSql.AppendLine(",@FromDate"); StrSql.AppendLine(",@ToDate"); StrSql.AppendLine(",@MthDays"); StrSql.AppendLine(",@WOffDays"); StrSql.AppendLine(",@Present"); StrSql.AppendLine(",@Absent"); StrSql.AppendLine(",@JobTime"); StrSql.AppendLine(",@TotHours"); StrSql.AppendLine(",@WorkHours"); StrSql.AppendLine(",@OverTime"); StrSql.AppendLine(",@LessTime"); StrSql.AppendLine(",@ExtraOrCut"); StrSql.AppendLine(",@BasicRate"); StrSql.AppendLine(",@PerDaySal"); StrSql.AppendLine(",@PerHourSal"); StrSql.AppendLine(",@CutSal"); StrSql.AppendLine(",@GiveSal"); StrSql.AppendLine(",@WorkSal"); StrSql.AppendLine(",@ExtraOrCutSal"); StrSql.AppendLine(",GetDate(),Convert(VarChar,GetDate(),108),@Entry_UID,0"); StrSql.AppendLine(")"); Cmd = new SqlCommand(StrSql.ToString().Replace("\r\n", " "), SqlFunc.gConn); Cmd.Parameters.AddWithValue("@TransactionId", IntNewTransId); Cmd.Parameters.AddWithValue("@EmpId", int.Parse(dtTemp.Rows[i]["EmpId"].ToString())); Cmd.Parameters.AddWithValue("@MMonth", ddlmonth.SelectedItem.Text.ToString()); Cmd.Parameters.AddWithValue("@MYear", int.Parse(ddlyear.SelectedValue)); Cmd.Parameters.AddWithValue("@FromDate", ValueConvert.ConvertDate(TxtFDate.Text.ToString())); Cmd.Parameters.AddWithValue("@ToDate", ValueConvert.ConvertDate(TxtTDate.Text.ToString())); Cmd.Parameters.AddWithValue("@MthDays", int.Parse(dtTemp.Rows[i]["Month_Days"].ToString())); Cmd.Parameters.AddWithValue("@WOffDays", int.Parse(dtTemp.Rows[i]["Sunday"].ToString())); Cmd.Parameters.AddWithValue("@Present", double.Parse(dtTemp.Rows[i]["Present"].ToString())); Cmd.Parameters.AddWithValue("@Absent", double.Parse(dtTemp.Rows[i]["Absent"].ToString())); Cmd.Parameters.AddWithValue("@JobTime", dtTemp.Rows[i]["JobTime"].ToString()); Cmd.Parameters.AddWithValue("@TotHours", double.Parse(dtTemp.Rows[i]["TotHours"].ToString())); Cmd.Parameters.AddWithValue("@WorkHours", double.Parse(dtTemp.Rows[i]["WorkHours"].ToString())); Cmd.Parameters.AddWithValue("@OverTime", double.Parse(dtTemp.Rows[i]["OverTime"].ToString())); Cmd.Parameters.AddWithValue("@LessTime", double.Parse(dtTemp.Rows[i]["LessTime"].ToString())); Cmd.Parameters.AddWithValue("@ExtraOrCut", double.Parse(dtTemp.Rows[i]["ExtraOrCut"].ToString())); Cmd.Parameters.AddWithValue("@BasicRate", double.Parse(dtTemp.Rows[i]["BasicRate"].ToString())); Cmd.Parameters.AddWithValue("@PerDaySal", double.Parse(dtTemp.Rows[i]["PerDay_Salary"].ToString())); Cmd.Parameters.AddWithValue("@PerHourSal", double.Parse(dtTemp.Rows[i]["PerHours_Salary"].ToString())); Cmd.Parameters.AddWithValue("@CutSal", double.Parse(dtTemp.Rows[i]["Cut_Salary"].ToString())); Cmd.Parameters.AddWithValue("@GiveSal", double.Parse(dtTemp.Rows[i]["Give_Salary"].ToString())); Cmd.Parameters.AddWithValue("@WorkSal", double.Parse(dtTemp.Rows[i]["WorkSalary"].ToString())); Cmd.Parameters.AddWithValue("@ExtraOrCutSal", double.Parse(dtTemp.Rows[i]["ExtraOrCutSalary"].ToString())); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); SqlFunc.ExecuteNonQuery(Cmd); } FillGrid(); LblMsg.Text = "Salary Generate Successfully !!!"; } else { GridSal.DataSource = null; GridSal.DataBind(); LblMsg.Text = "Data Not Found For Generate Salary !!!"; return; } } catch (Exception ex) { SqlFunc.RollbackTransaction(); Response.Write(ex.ToString()); } finally { SqlFunc.EndConnWithTransaction(); } }
protected void BtnShow_Click(object sender, EventArgs e) { try { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("AssWrkInfoRV.rdlc"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select PL.EmpName As [Project_Ledger]" + Environment.NewLine); StrSql.AppendLine(" ,P.ProjectName As Project_Name" + Environment.NewLine); StrSql.AppendLine(" ,M.ModuleName As Module_Name" + Environment.NewLine); StrSql.AppendLine(" ,CM.ClientName As Client_Name" + Environment.NewLine); StrSql.AppendLine(" ,E.EmpName As Employee_Name" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.AssignDate,103) As [Assign_Date]" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.AssignTime,108) As [Assign_Time]" + Environment.NewLine); StrSql.AppendLine(" ,IsNull(W.DueDays,0) As [Due_Days]" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.DueDate,103) As [Due_Date]" + Environment.NewLine); StrSql.AppendLine(" ,W.WorkDet1 As [Work_1]" + Environment.NewLine); StrSql.AppendLine(" ,W.WorkDet2 As [Work_2]" + Environment.NewLine); StrSql.AppendLine(" ,W.WorkDet3 As [Work_3]" + Environment.NewLine); StrSql.AppendLine(" ,Case When IsNull(W.WorkStatus,'')='D' Then 'Done'" + Environment.NewLine); StrSql.AppendLine(" When IsNull(W.WorkStatus,'')='P' Then 'Pending'" + Environment.NewLine); StrSql.AppendLine(" When IsNull(W.WorkStatus,'')='C' Then 'Cancle'" + Environment.NewLine); StrSql.AppendLine(" Else '' End As [Work_Status]" + Environment.NewLine); StrSql.AppendLine(" ,W.Remark" + Environment.NewLine); StrSql.AppendLine(" ,Case When IsNull(W.CompleteDate,'')<>''" + Environment.NewLine); StrSql.AppendLine(" Then Convert(Varchar(10),W.CompleteDate,103) Else '' End As [Complete_Date]" + Environment.NewLine); StrSql.AppendLine(" ,Convert(Varchar(10),W.CompleteTime,108) As [Complete_Time]" + Environment.NewLine); StrSql.AppendLine(" From WorkAssDet W" + Environment.NewLine); StrSql.AppendLine(" Left Join Emp_Mast PL On PL.Id=W.PrjLedId " + Environment.NewLine); StrSql.AppendLine(" Left Join Project_Mast P On P.Id=W.PrjId" + Environment.NewLine); StrSql.AppendLine(" Left Join Project_Module M On M.Id=W.PrjModId" + Environment.NewLine); StrSql.AppendLine(" Left Join Client_Mast CM On CM.Id=P.ClientId" + Environment.NewLine); StrSql.AppendLine(" Left Join Emp_Mast E On E.Id=W.EmpId" + Environment.NewLine); StrSql.AppendLine(" Where 1=1 " + Environment.NewLine); if (DDLPrjLed.SelectedValue != "0") { StrSql.AppendLine("And W.PrjLedId=" + int.Parse(DDLPrjLed.SelectedValue.ToString()) + Environment.NewLine); } if (ddlEmployee.SelectedValue != "0") { StrSql.AppendLine("And W.EmpId=" + int.Parse(ddlEmployee.SelectedValue.ToString()) + Environment.NewLine); } if (DDLPrjName.SelectedValue != "0") { StrSql.AppendLine("And W.PrjId=" + int.Parse(DDLPrjName.SelectedValue.ToString()) + Environment.NewLine); } if (DDLPrjModule.SelectedValue != "0") { StrSql.AppendLine("And W.PrjModId=" + int.Parse(DDLPrjModule.SelectedValue.ToString()) + Environment.NewLine); } if (TxtAssignDate.Text.Trim() != "") { StrSql.AppendLine("And W.AssignDate ='" + ValueConvert.ConvertDate(TxtAssignDate.Text.Trim()) + "'" + Environment.NewLine); } if (ddlWrkStatus.SelectedValue != "0") { StrSql.AppendLine("And W.WorkStatus='" + ddlWrkStatus.SelectedValue.ToString() + "'" + Environment.NewLine); } if (TxtDueDate.Text.Trim() != "") { StrSql.AppendLine("And W.DueDate ='" + ValueConvert.ConvertDate(TxtDueDate.Text.Trim()) + "'" + Environment.NewLine); } StrSql.AppendLine(" Order By PL.EmpName,P.ProjectName,M.ModuleName,E.EmpName" + Environment.NewLine); HRMDataSet dsAssWorkInfo = ComFunc.GetData(StrSql.ToString().Replace("\r\n", " "), "AssWorkInfo"); ReportDataSource WorkDataSource = new ReportDataSource("AssWorkInfo", dsAssWorkInfo.Tables["AssWorkInfo"]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(WorkDataSource); } catch { Response.Redirect("~/ErrorPage.aspx"); } }
protected void BtnShow_Click(object sender, EventArgs e) { try { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("LeaveInfoRV.rdlc"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select E.EmpName"); StrSql.AppendLine(",Convert(Varchar(10),L.Application_Date,103) As Application_Date "); StrSql.AppendLine(",Convert(Varchar(10),L.FromDate,103) As From_Date"); StrSql.AppendLine(",Convert(Varchar(10),L.ToDate,103) As To_Date"); StrSql.AppendLine(",L.TotalDays As Total_Days"); StrSql.AppendLine(",Case When IsNull(L.LeaveStatus,'')='A' Then 'Approve'"); StrSql.AppendLine(" When IsNull(L.LeaveStatus,'')='U' Then 'UnApproved' "); StrSql.AppendLine(" When IsNull(L.LeaveStatus,'')='C' Then 'Cancel'"); StrSql.AppendLine(" Else '' End As Leave_Status"); StrSql.AppendLine(",Case When IsNull(L.LeaveType,'')='H' Then 'Half Day'"); StrSql.AppendLine(" When IsNull(L.LeaveType,'')='F' Then 'Full Day'"); StrSql.AppendLine(" Else '' End As Leave_Type"); StrSql.AppendLine(",L.Reason,L.Remark "); StrSql.AppendLine("From Leave_Application L"); StrSql.AppendLine("Left Join Emp_Mast E On E.Id=L.EmpId"); StrSql.AppendLine("Where 1=1"); if (ddlEmployee.SelectedValue != "0") { StrSql.AppendLine("And L.EmpId=" + int.Parse(ddlEmployee.SelectedValue.ToString())); } if (DDLLeaveType.SelectedValue != "0") { StrSql.AppendLine("And IsNull(L.LeaveType,'')='" + DDLLeaveType.SelectedValue.ToString() + "'"); } if (DDLStatus.SelectedValue != "0") { StrSql.AppendLine("And IsNull(L.LeaveStatus,'')='" + DDLStatus.SelectedValue.ToString() + "'"); } if (TxtAppFDate.Text.Trim() != "") { StrSql.AppendLine("And L.Application_Date >='" + ValueConvert.ConvertDate(TxtAppFDate.Text.Trim()) + "'"); } if (TxtAppTDate.Text.Trim() != "") { StrSql.AppendLine("And L.Application_Date <='" + ValueConvert.ConvertDate(TxtAppTDate.Text.Trim()) + "'"); } StrSql.AppendLine("Order By E.EmpName,Convert(Varchar(10),L.Application_Date,103)"); HRMDataSet dsAssWorkInfo = ComFunc.GetData(StrSql.ToString().Replace("\r\n", " "), "LeaveInfo"); ReportDataSource WorkDataSource = new ReportDataSource("LeaveInfo", dsAssWorkInfo.Tables["LeaveInfo"]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(WorkDataSource); } catch { Response.Redirect("~/ErrorPage.aspx"); } }
protected void GridModule_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName.Equals("AddNew")) { TextBox TxtFtrModName = (TextBox)GridModule.FooterRow.FindControl("TxtFtrModName"); TextBox TxtFtrStartDate = (TextBox)GridModule.FooterRow.FindControl("TxtFtrStartDate"); TextBox TxtFtrEndDate = (TextBox)GridModule.FooterRow.FindControl("TxtFtrEndDate"); DropDownList DDlFtrModStat = (DropDownList)GridModule.FooterRow.FindControl("DDlFtrModStat"); TextBox TxtFtrRemark = (TextBox)GridModule.FooterRow.FindControl("TxtFtrRemark"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Insert Into Project_Module"); StrSql.AppendLine("(ProjectId,ModuleName"); StrSql.AppendLine(",StartDate,EndDate"); StrSql.AppendLine(",ModuleStatus,Remark"); StrSql.AppendLine(",Entry_Date,Entry_Time"); StrSql.AppendLine(",Entry_UID,UPDFLAG)"); StrSql.AppendLine("Values"); StrSql.AppendLine("(@ProjectId,@ModuleName"); StrSql.AppendLine(",@StartDate,@EndDate"); StrSql.AppendLine(",@ModuleStatus,@Remark"); StrSql.AppendLine(",GETDATE(),CONVERT(VarChar,GETDATE(),108)"); StrSql.AppendLine(",@Entry_UID,0)"); Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); Cmd.Parameters.AddWithValue("@ProjectId", int.Parse(HidFldId.Value)); Cmd.Parameters.AddWithValue("@ModuleName", TxtFtrModName.Text); if (TxtFtrStartDate.Text.Length != 0) { Cmd.Parameters.AddWithValue("@StartDate", ValueConvert.ConvertDate(TxtFtrStartDate.Text)); } else { Cmd.Parameters.AddWithValue("@StartDate", DBNull.Value); } if (TxtFtrEndDate.Text.Length != 0) { Cmd.Parameters.AddWithValue("@EndDate", ValueConvert.ConvertDate(TxtFtrEndDate.Text)); } else { Cmd.Parameters.AddWithValue("@EndDate", DBNull.Value); } Cmd.Parameters.AddWithValue("@ModuleStatus", DDlFtrModStat.Text); Cmd.Parameters.AddWithValue("@Remark", TxtFtrRemark.Text); Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value); int result = SqlFunc.ExecuteNonQuery(Cmd); if (result == 1) { FillModuleData(); } else { LblMsg.ForeColor = Color.Red; LblMsg.Text = "Module details not inserted"; } } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void BtnShow_Click(object sender, EventArgs e) { try { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("ClientInfoRV.rdlc"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select C.ClientName,C.FirmName"); StrSql.AppendLine(",CONVERT(VarChar(10),DOJ,103) As DOJ"); StrSql.AppendLine(",C.EMailId"); StrSql.AppendLine(",CM.CountryName"); StrSql.AppendLine(",SM.StateName"); StrSql.AppendLine(",Ci.CityName"); StrSql.AppendLine(",C.Address1,C.PinCode,C.MobNo,C.Phone"); StrSql.AppendLine(",CONVERT(VarChar(10),LeftDate,103) As LeftDate"); StrSql.AppendLine("From Client_Mast C"); StrSql.AppendLine("Left Join Country_Mast CM On CM.Id=C.CountryId"); StrSql.AppendLine("Left Join State_Mast SM On SM.Id=C.StateId"); StrSql.AppendLine("Left Join City_Mast Ci On Ci.Id=C.CityId"); StrSql.AppendLine("Where 1=1"); if (TxtClientName.Text.Length != 0) { StrSql.AppendLine("And C.ClientName='" + TxtClientName.Text.Trim() + "'"); } if (TxtFirmName.Text.Length != 0) { StrSql.AppendLine("And C.FirmName='" + TxtFirmName.Text.Trim() + "'"); } if (TxtFDOJ.Text.Trim() != "") { StrSql.AppendLine("And C.DOJ >= '" + ValueConvert.ConvertDate(TxtFDOJ.Text.Trim()) + "'"); } if (TxtTDOJ.Text.Trim() != "") { StrSql.AppendLine("And C.DOJ <= '" + ValueConvert.ConvertDate(TxtTDOJ.Text.Trim()) + "'"); } if (TxtEMailId.Text.Length != 0) { StrSql.AppendLine("And C.EMailId='" + TxtEMailId.Text.Trim() + "'"); } if (ddlCountry.SelectedValue != "0") { StrSql.AppendLine("And C.CountryId=" + int.Parse(ddlCountry.SelectedValue.ToString())); } if (ddlState.SelectedValue != "0") { StrSql.AppendLine("And C.StateId=" + int.Parse(ddlState.SelectedValue.ToString())); } if (ddlCity.SelectedValue != "0") { StrSql.AppendLine("And C.CityId=" + int.Parse(ddlCity.SelectedValue.ToString())); } if (TxtFLeftDate.Text.Trim() != "") { StrSql.AppendLine("And C.LeftDate >='" + ValueConvert.ConvertDate(TxtFLeftDate.Text.Trim()) + "'"); } if (TxtTLeftDate.Text.Trim() != "") { StrSql.AppendLine("And C.LeftDate <='" + ValueConvert.ConvertDate(TxtTLeftDate.Text.Trim()) + "'"); } StrSql.AppendLine("Order By C.ClientName"); HRMDataSet dsAssWorkInfo = ComFunc.GetData(StrSql.ToString().Replace("\r\n", " "), "ClientInfo"); ReportDataSource WorkDataSource = new ReportDataSource("ClientInfo", dsAssWorkInfo.Tables["ClientInfo"]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(WorkDataSource); } catch { Response.Redirect("~/ErrorPage.aspx"); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { //if (TxtEmpName.Text.Length == 0) //{ // //LblMsg.Text = "Employee Name Is Blank, Enter Valid Employee Name...."; // TxtEmpName.Focus(); // return; //} //if (DDLEmpGroup.SelectedValue == "0") //{ // //LblMsg.Text = "Select Employee Group...."; // DDLEmpGroup.Focus(); // return; //} //if (TxtFJobTime.Text.Length == 0) //{ // //LblMsg.Text = "Job From Time Is Blank, Enter Valid Time...."; // TxtFJobTime.Focus(); // return; //} //if (TxtTJobTime.Text.Length == 0) //{ // //LblMsg.Text = "Job To Time Is Blank, Enter Valid Time...."; // TxtTJobTime.Focus(); // return; //} //if (TxtBasicSal.Text.Length == 0) //{ // //LblMsg.Text = "Basic Rate Is Blank, Enter Valid Rate...."; // TxtBasicSal.Focus(); // return; //} //if (TxtDOJ.Text.Length == 0) //{ // //LblMsg.Text = "Date Of Join Is Blank, Enter Valid Join Date...."; // TxtDOJ.Focus(); // return; //} //if (TxtDOB.Text.Length == 0) //{ // //LblMsg.Text = "DOB Is Blank, Enter Valid Brith Date...."; // TxtDOB.Focus(); // return; //} //if (TxtEMailId.Text.Length == 0) //{ // //LblMsg.Text = "EMail Id Is Blank, Enter Valid EMail Id...."; // TxtEMailId.Focus(); // return; //} //if (TxtMobNo.Text.Length == 0) //{ // //LblMsg.Text = "Mob.No Is Blank, Enter Valid Mob.No...."; // TxtMobNo.Focus(); // return; //} //if (TxtPassword.Text.Length == 0) //{ // //LblMsg.Text = "Password Is Blank, Enter Valid Password...."; // TxtPassword.Focus(); // return; //} StrSql = new StringBuilder(); StrSql.Length = 0; if (HidFldId.Value.Length == 0) { StrSql.AppendLine("Insert Into Emp_Mast"); StrSql.AppendLine("(EmpName,DeptId,DesigId"); StrSql.AppendLine(",EmpGroup,FJobTime,TJobTime,TotTime,BasicRate"); StrSql.AppendLine(",DOJ,DOB"); StrSql.AppendLine(",Gender,EMailId"); StrSql.AppendLine(",CountryId,StateId,CityId"); StrSql.AppendLine(",Address1,PinCode"); StrSql.AppendLine(",MobNo,Phone"); StrSql.AppendLine(",BloodGroup,LeftDate"); StrSql.AppendLine(",Entry_Date,Entry_Time"); StrSql.AppendLine(",Entry_UID,UPDFLAG,Password"); StrSql.AppendLine(")"); StrSql.AppendLine("Values(@EmpName,@DeptId,@DesigId"); StrSql.AppendLine(",@EmpGroup,@FJobTime,@TJobTime,@TotTime,@BasicRate "); StrSql.AppendLine(",@DOJ,@DOB"); StrSql.AppendLine(",@Gender,@EMailId"); StrSql.AppendLine(",@CountryId,@StateId,@CityId"); StrSql.AppendLine(",@Address1,@PinCode"); StrSql.AppendLine(",@MobNo,@Phone"); StrSql.AppendLine(",@BloodGroup,@LeftDate"); StrSql.AppendLine(",GetDate(),Convert(VarChar,GetDate(),108)"); StrSql.AppendLine(",@Entry_UID,0,@Password)"); } else { StrSql.AppendLine("Update Emp_Mast"); StrSql.AppendLine("Set EmpName=@EmpName,DeptId=@DeptId,DesigId=@DesigId"); StrSql.AppendLine(",EmpGroup=@EmpGroup,FJobTime=@FJobTime,TJobTime=@TJobTime,TotTime=@TotTime"); StrSql.AppendLine(",BasicRate=@BasicRate,DOJ=@DOJ,DOB=@DOB"); StrSql.AppendLine(",Gender=@Gender,EMailId=@EMailId"); StrSql.AppendLine(",CountryId=@CountryId,StateId=@StateId,CityId=@CityId"); StrSql.AppendLine(",Address1=@Address1,PinCode=@PinCode"); StrSql.AppendLine(",MobNo=@MobNo,Phone=@Phone"); StrSql.AppendLine(",BloodGroup=@BloodGroup,LeftDate=@LeftDate"); StrSql.AppendLine(",MEntry_Date=GetDate(),MEntry_Time=Convert(Varchar,GetDate(),108)"); StrSql.AppendLine(",MEntry_UID=@Entry_UID,UPDFLAG=IsNull(UPDFlag,0)+1,Password=@Password"); StrSql.AppendLine("Where Id=@Id"); } Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn); Cmd.Parameters.AddWithValue("@EmpName", TxtEmpName.Text.Trim()); if (DDLDeptName.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@DeptId", DDLDeptName.SelectedValue); } else { Cmd.Parameters.AddWithValue("@DeptId", DBNull.Value); } if (DDLDesignation.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@DesigId", DDLDesignation.SelectedValue); } else { Cmd.Parameters.AddWithValue("@DesigId", DBNull.Value); } if (DDLEmpGroup.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@EmpGroup", DDLEmpGroup.SelectedValue); } else { Cmd.Parameters.AddWithValue("@EmpGroup", DBNull.Value); } Cmd.Parameters.AddWithValue("@FJobTime", TxtFJobTime.Text.Trim()); Cmd.Parameters.AddWithValue("@TJobTime", TxtTJobTime.Text.Trim()); Cmd.Parameters.AddWithValue("@TotTime", TxtTotHours.Text.Trim()); Cmd.Parameters.AddWithValue("@BasicRate", TxtBasicSal.Text.Trim()); Cmd.Parameters.AddWithValue("@DOJ", ValueConvert.ConvertDate(TxtDOJ.Text)); Cmd.Parameters.AddWithValue("@DOB", ValueConvert.ConvertDate(TxtDOB.Text)); Cmd.Parameters.AddWithValue("@Gender", rblGender.SelectedValue); Cmd.Parameters.AddWithValue("@EMailId", TxtEMailId.Text.Trim()); Cmd.Parameters.AddWithValue("@Password", Sec.Encrypt(TxtPassword.Text.Trim())); if (ddlCountry.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@CountryId", ddlCountry.SelectedValue); } else { Cmd.Parameters.AddWithValue("@CountryId", DBNull.Value); } if (ddlState.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@StateId", ddlState.SelectedValue); } else { Cmd.Parameters.AddWithValue("@StateId", DBNull.Value); } if (ddlCity.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@CityId", ddlCity.SelectedValue); } else { Cmd.Parameters.AddWithValue("@CityId", DBNull.Value); } Cmd.Parameters.AddWithValue("@Address1", TxtAddress1.Text.Trim()); Cmd.Parameters.AddWithValue("@PinCode", TxtPinCode.Text.Trim()); Cmd.Parameters.AddWithValue("@MobNo", TxtMobNo.Text.Trim()); Cmd.Parameters.AddWithValue("@Phone", TxtPhone.Text.Trim()); if (ddlBloodGrp.SelectedValue != "0") { Cmd.Parameters.AddWithValue("@BloodGroup", ddlBloodGrp.SelectedValue); } else { Cmd.Parameters.AddWithValue("@BloodGroup", DBNull.Value); } if (TxtLeftDate.Text.Length != 0) { Cmd.Parameters.AddWithValue("@LeftDate", ValueConvert.ConvertDate(TxtLeftDate.Text)); } else { Cmd.Parameters.AddWithValue("@LeftDate", DBNull.Value); } Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value.ToString()); if (HidFldId.Value.Length == 0) { SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Employee added successfully"; } else { Cmd.Parameters.AddWithValue("@ID", HidFldId.Value.ToString()); SqlFunc.ExecuteNonQuery(Cmd); LblMsg.Text = "Employee updated successfully"; } FillGrid(); ClearAll(); MyMenu.Items[0].Selected = true; MyMenu.Items[0].ImageUrl = "~/Images/ViewEnable.jpg"; MyMultiView.ActiveViewIndex = 0; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditDisable.jpg"; } catch (Exception ex) { Response.Write(ex); } }
protected void BtnShow_Click(object sender, EventArgs e) { try { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("ProjectListRV.rdlc"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select P.ProjectName"); StrSql.AppendLine(",Convert(Varchar(10),P.StartDate,103) As StartDate"); StrSql.AppendLine(",Convert(Varchar(10),P.EndDate,103) As EndDate"); StrSql.AppendLine(",Case When IsNull(P.ProjctStatus,'')='D' Then 'Done'"); StrSql.AppendLine(" When IsNull(P.ProjctStatus,'')='P' Then 'Pending'"); StrSql.AppendLine("Else '' End As ProjctStatus"); StrSql.AppendLine(",P.Remark,C.ClientName"); StrSql.AppendLine(",M.ModuleName"); StrSql.AppendLine(",Convert(Varchar(10),M.StartDate,103) As ModStart_Date"); StrSql.AppendLine(",Convert(Varchar(10),M.EndDate,103) As ModEnd_Date"); StrSql.AppendLine(",Case When IsNull(M.ModuleStatus,'')='D' Then 'Done'"); StrSql.AppendLine(" When IsNull(M.ModuleStatus,'')='P' Then 'Pending'"); StrSql.AppendLine(" When IsNull(M.ModuleStatus,'')='C' Then 'Cancel'"); StrSql.AppendLine("Else '' End As ModuleStatus"); StrSql.AppendLine(",M.Remark As ModRemark"); StrSql.AppendLine("From Project_Mast P"); StrSql.AppendLine("Left Join Project_Module M On P.Id=M.ProjectId"); StrSql.AppendLine("Left Join Client_Mast C On P.ClientId=C.Id"); StrSql.AppendLine("Where 1=1 "); if (DDLPrjName.SelectedValue != "0") { StrSql.AppendLine("And P.Id=" + DDLPrjName.SelectedValue); } if (ddlPrjStatus.SelectedValue != "0") { StrSql.AppendLine("And P.ProjctStatus='" + ddlPrjStatus.SelectedValue + "'"); } if (TxtStartDate.Text.Length != 0) { StrSql.AppendLine("And P.StartDate >='" + ValueConvert.ConvertDate(TxtStartDate.Text) + "'"); } if (TxtEndDate.Text.Length != 0) { StrSql.AppendLine("And P.EndDate <='" + ValueConvert.ConvertDate(TxtEndDate.Text) + "'"); } if (DDLPrjModule.SelectedValue != "0") { StrSql.AppendLine("And M.Id=" + DDLPrjModule.SelectedValue); } if (ddlModStatus.SelectedValue != "0") { StrSql.AppendLine("And M.ModuleStatus='" + ddlModStatus.SelectedValue + "'"); } if (TxtModStartDate.Text.Length != 0) { StrSql.AppendLine("And M.StartDate >='" + ValueConvert.ConvertDate(TxtModStartDate.Text) + "'"); } if (TxtModEndDate.Text.Length != 0) { StrSql.AppendLine("And M.EndDate <='" + ValueConvert.ConvertDate(TxtModEndDate.Text) + "'"); } StrSql.AppendLine(" Order By P.ProjectName"); HRMDataSet dsProjectInfo = ComFunc.GetData(StrSql.ToString().Replace("\r\n", " "), "ProjectInfo"); ReportDataSource PrjDataSource = new ReportDataSource("ProjectInfo", dsProjectInfo.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(PrjDataSource); } catch (Exception ex) { Response.Write(ex.ToString()); } }
public XmlElement GetProjectList(int pIntPrjId, string pStrPrjStatus, string pStrPrjStartDate, string pStrPrjEndDate , int pIntModId, string pStrModStatus, string pStrModStartDate, string pStrModEndDate) { try { StrSql = new StringBuilder(); StrSql.Length = 0; // P.Id,M.Id As ModuleId,P.ClientId StrSql.AppendLine("Select P.ProjectName"); StrSql.AppendLine(",Convert(Varchar(10),P.StartDate,103) As StartDate"); StrSql.AppendLine(",Convert(Varchar(10),P.EndDate,103) As EndDate"); StrSql.AppendLine(",Case When IsNull(P.ProjctStatus,'')='D' Then 'Done'"); StrSql.AppendLine(" When IsNull(P.ProjctStatus,'')='P' Then 'Pending'"); StrSql.AppendLine("Else '' End As ProjctStatus"); StrSql.AppendLine(",P.Remark,C.ClientName"); StrSql.AppendLine(",M.ModuleName"); StrSql.AppendLine(",Convert(Varchar(10),M.StartDate,103) As ModStart_Date"); StrSql.AppendLine(",Convert(Varchar(10),M.EndDate,103) As ModEnd_Date"); StrSql.AppendLine(",Case When IsNull(M.ModuleStatus,'')='D' Then 'Done'"); StrSql.AppendLine(" When IsNull(M.ModuleStatus,'')='P' Then 'Pending'"); StrSql.AppendLine(" When IsNull(M.ModuleStatus,'')='C' Then 'Cancel'"); StrSql.AppendLine("Else '' End As ModuleStatus"); StrSql.AppendLine(",M.Remark As ModRemark"); StrSql.AppendLine("From Project_Mast P"); StrSql.AppendLine("Left Join Project_Module M On P.Id=M.ProjectId"); StrSql.AppendLine("Left Join Client_Mast C On P.ClientId=C.Id"); StrSql.AppendLine("Where 1=1 "); if (pIntPrjId != 0) { StrSql.AppendLine("And P.Id=" + pIntPrjId); } if (pStrPrjStatus != "0") { StrSql.AppendLine("And P.ProjctStatus='" + pStrPrjStatus + "'"); } if (pStrPrjStartDate != "") { StrSql.AppendLine("And P.StartDate >='" + ValueConvert.ConvertDate(pStrPrjStartDate) + "'"); } if (pStrPrjEndDate != "") { StrSql.AppendLine("And P.EndDate <='" + ValueConvert.ConvertDate(pStrPrjEndDate) + "'"); } if (pIntModId != 0) { StrSql.AppendLine("And M.Id=" + pIntModId); } if (pStrModStatus != "0") { StrSql.AppendLine("And M.ModuleStatus='" + pStrModStatus + "'"); } if (pStrModStartDate != "") { StrSql.AppendLine("And M.StartDate >='" + ValueConvert.ConvertDate(pStrModStartDate) + "'"); } if (pStrModEndDate != "") { StrSql.AppendLine("And M.EndDate <='" + ValueConvert.ConvertDate(pStrModEndDate) + "'"); } ds = new DataSet(); ds = SqlFunc.ExecuteDataSet(StrSql.ToString().Replace("\r\n", " ")); //Return the DataSet as an XmlElement. XmlDataDocument xmldata = new XmlDataDocument(ds); XmlElement xmlElement = xmldata.DocumentElement; return(xmlElement); } catch (Exception ex) { throw ex; } }
protected void BtnShow_Click(object sender, EventArgs e) { try { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("DRFInfoRV.rdlc"); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select E.EmpName"); StrSql.AppendLine(",Convert(Varchar(10),H.DRFDate,103) As DRFDate"); StrSql.AppendLine(",H.InTime,H.OutTime,H.TotTime As TotTimeH,H.Remark"); StrSql.AppendLine(",D.StartTime,D.EndTime,D.TotTime As TotTimeD"); StrSql.AppendLine(",P.ProjectName,M.ModuleName"); StrSql.AppendLine(",D.Work_Desc"); StrSql.AppendLine(",Case When IsNull(D.WorkStatus,'')='D' Then 'Done'"); StrSql.AppendLine(" When IsNull(D.WorkStatus,'')='P' Then 'Pending'"); StrSql.AppendLine(" When IsNull(D.WorkStatus,'')='C' Then 'Cancel' Else '' End As WorkStatus"); StrSql.AppendLine(",D.Remark"); StrSql.AppendLine("From DRFH H"); StrSql.AppendLine("Left Join Emp_Mast E On H.EmpId=E.Id"); StrSql.AppendLine("Left Join DRFDET D On D.DRFId=H.Id"); StrSql.AppendLine("Left Join Project_Mast P On P.Id=D.PrjId"); StrSql.AppendLine("Left Join Project_Module M On M.ProjectId=P.Id And M.Id=D.PrjModId"); StrSql.AppendLine("Where 1=1"); if (ddlEmployee.SelectedValue != "0") { StrSql.AppendLine("And H.EmpId=" + int.Parse(ddlEmployee.SelectedValue.ToString())); } if (TxtFDrfDate.Text.Trim() != "") { StrSql.AppendLine("And H.DRFDate >='" + ValueConvert.ConvertDate(TxtFDrfDate.Text.Trim()) + "'"); } if (TxtTDrfDate.Text.Trim() != "") { StrSql.AppendLine("And H.DRFDate <='" + ValueConvert.ConvertDate(TxtTDrfDate.Text.Trim()) + "'"); } if (DDLPrjName.SelectedValue != "0") { StrSql.AppendLine("And D.PrjId=" + int.Parse(DDLPrjName.SelectedValue.ToString())); } if (DDLPrjModule.SelectedValue != "0") { StrSql.AppendLine("And D.PrjModId=" + int.Parse(DDLPrjModule.SelectedValue.ToString())); } if (DDlWorkStat.SelectedValue != "0") { StrSql.AppendLine("And IsNull(D.WorkStatus,'')='" + DDlWorkStat.SelectedValue + "'"); } StrSql.AppendLine("Order By E.EmpName,Convert(Varchar(10),H.DRFDate,103)"); HRMDataSet dsAssWorkInfo = ComFunc.GetData(StrSql.ToString().Replace("\r\n", " "), "DRFInfo"); ReportDataSource WorkDataSource = new ReportDataSource("DRFInfo", dsAssWorkInfo.Tables["DRFInfo"]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(WorkDataSource); } catch { Response.Redirect("~/ErrorPage.aspx"); } }