private string DataValidate(string tEmpUnqID, string tCostCode, DateTime tValidFrom) { string err = string.Empty; clsEmp t = new clsEmp(); t.CompCode = "01"; t.EmpUnqID = tEmpUnqID; if (!t.GetEmpDetails(t.CompCode, t.EmpUnqID)) { err = err + "Invalid/InActive EmpUnqID..." + Environment.NewLine; } t.CostCode = tCostCode; t.GetCostDesc(tCostCode); if (string.IsNullOrEmpty(t.CostDesc)) { err = err + "Invalid CostCode..." + Environment.NewLine; } if (tValidFrom == DateTime.MinValue) { err = err + "Please Enter Valid From Date..." + Environment.NewLine; return(err); } string sql = "Select max(ValidFrom) From MastCostCodeEmp where EmpUnqId = '" + t.EmpUnqID + "' " + " and ValidFrom > '" + tValidFrom.ToString("yyyy-MM-dd") + "'"; string tMaxDt = Utils.Helper.GetDescription(sql, Utils.Helper.constr); if (!string.IsNullOrEmpty(tMaxDt)) { err = err + "System Does not Allow to insert/update/delete between...." + Environment.NewLine; } return(err); }