Example #1
0
 public string AddYakkrInfo(Yakkr info, int mode, Guid userId, string AgencyId)
 {
     try
     {
         command.Connection  = Connection;
         command.CommandText = "SP_addyakkrinfo";
         command.Parameters.AddWithValue("@mode", mode);
         command.Parameters.AddWithValue("@YakkrRoleID", info.YakkrRoleID);
         command.Parameters.AddWithValue("@YakkrID", info.YakkrID);
         command.Parameters.AddWithValue("@AgencyId", AgencyId);
         command.Parameters.AddWithValue("@Value", (info.Value));
         command.Parameters.AddWithValue("@Description", info.Description == null ? null : info.Description.Trim());
         command.Parameters.AddWithValue("@StaffRoleID", info.StaffRoleID);
         command.Parameters.AddWithValue("@SecondaryRoleID", info.SecondaryRoleID);
         command.Parameters.AddWithValue("@CreatedBy", userId);
         command.Parameters.AddWithValue("@result", "").Direction = ParameterDirection.Output;
         command.CommandType = CommandType.StoredProcedure;
         Connection.Open();
         command.ExecuteNonQuery();
         Connection.Close();
         return(command.Parameters["@result"].Value.ToString());
     }
     catch (Exception ex)
     {
         clsError.WriteException(ex);
         return("");
     }
     //return command.Parameters["@result"].Value.ToString();
 }
Example #2
0
        public Yakkr Getyakkrdetailinfo(string YakkrID, string AgencyId)
        {
            Yakkr obj = new Yakkr();

            try
            {
                command.Parameters.Add(new SqlParameter("@YakkrID", YakkrID));
                command.Parameters.Add(new SqlParameter("@AgencyId", AgencyId));
                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_getyakkedetailsinfo";
                DataAdapter         = new SqlDataAdapter(command);
                yakkrdataTable      = new DataTable();
                DataAdapter.Fill(yakkrdataTable);
                if (yakkrdataTable != null && yakkrdataTable.Rows.Count > 0)
                {
                    if (!DBNull.Value.Equals(yakkrdataTable.Rows[0]["YakkrRoleID"]))
                    {
                        obj.YakkrRoleID = Convert.ToInt32(yakkrdataTable.Rows[0]["YakkrRoleID"]);
                    }
                    else
                    {
                        obj.YakkrRoleID = 0;
                    }
                    obj.Value       = yakkrdataTable.Rows[0]["Value"].ToString();
                    obj.StaffRoleID = yakkrdataTable.Rows[0]["StaffRoleID"].ToString();
                    obj.Description = yakkrdataTable.Rows[0]["Description"].ToString();
                    // obj.DateEntered = Convert.ToDateTime(yakkrdataTable.Rows[0]["DateEntered"]).ToString("MM/dd/yyyy");
                    obj.SecondaryRoleID = yakkrdataTable.Rows[0]["OptionalRoleID"].ToString();
                    //   obj.YakkrID = yakkrdataTable.Rows[0]["YakkrCode"].ToString();
                    // obj.FormalAgreement = Convert.ToBoolean(yakkrdataTable.Rows[0]["FormalAgreement"].ToString());
                }
                DataAdapter.Dispose();
                command.Dispose();
                yakkrdataTable.Dispose();
                return(obj);
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
                return(obj);
            }
            finally
            {
                DataAdapter.Dispose();
                command.Dispose();
                yakkrdataTable.Dispose();
            }
        }
        public ActionResult Yakkr()
        {
            //if (!String.IsNullOrWhiteSpace(Convert.ToString(Session["AgencyID"])))
            //{
            ViewBag.mode = 0;
            Yakkr _Yakkr = (new YakkrData()).GetData_YakkrData(Session["AgencyID"].ToString());

            ViewBag.YakkrList             = _Yakkr.YakkrList;
            TempData["YakkrList"]         = ViewBag.YakkrList;
            ViewBag._YakkrRolesList       = _Yakkr._YakkrRolesList;
            TempData["_YakkrRolesList"]   = ViewBag._YakkrRolesList;
            ViewBag._YakkrAgencyCodes     = _Yakkr._YakkrAgencyCodes;
            TempData["_YakkrAgencyCodes"] = ViewBag._YakkrAgencyCodes;
            return(View(_Yakkr));
        }
        public ActionResult Yakkr(Yakkr info, FormCollection collection)
        {
            try
            {
                TempData.Keep();
                string    message = "";
                YakkrData obj     = new YakkrData();
                if (info.YakkrRoleID == 0)
                {
                    info.YakkrID     = collection["DdlYakkrList"].ToString() == "0" ? null : collection["DdlYakkrList"].ToString();
                    info.StaffRoleID = collection["DdlStaffList"].ToString() == "0" ? null : collection["DdlStaffList"].ToString();

                    info.SecondaryRoleID = collection["DdlStaffSecondaryList"] == null ? null : collection["DdlStaffSecondaryList"].ToString();
                    message        = obj.AddYakkrInfo(info, 0, Guid.Parse(Session["UserID"].ToString()), Session["AgencyID"].ToString());
                    ViewBag.result = "Sucess";
                }
                else
                {
                    info.YakkrID     = collection["DdlYakkrList"].ToString() == "0" ? null : collection["DdlYakkrList"].ToString();
                    info.StaffRoleID = collection["DdlStaffList"].ToString() == "0" ? null : collection["DdlStaffList"].ToString();

                    info.SecondaryRoleID = collection["DdlStaffSecondaryList"] == null ? null : collection["DdlStaffSecondaryList"].ToString();
                    message        = obj.AddYakkrInfo(info, 1, Guid.Parse(Session["UserID"].ToString()), Session["AgencyID"].ToString());
                    ViewBag.result = "Sucess";
                }
                if (message == "1")
                {
                    // TempData["message"] = "Record added successfully.";
                    ViewBag.message = "Record added successfully.";
                }
                else if (message == "2")
                {
                    ViewBag.message = "Record updated successfully.";
                }
                else if (message == "3")
                {
                    ViewBag.message = "Record already exist.";
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            info.YakkrList         = (List <Yakkr.YakkrCode>)TempData["YakkrList"];
            info._YakkrRolesList   = (List <Yakkr.YakkrRoles>)TempData["_YakkrRolesList"];
            info._YakkrAgencyCodes = (List <Yakkr.YakkrAgencyCodes>)TempData["_YakkrAgencyCodes"];
            return(View(info));
        }
Example #5
0
        public Yakkr GetData_YakkrData(String AgencyID)
        {
            Yakkr _staff = new Yakkr();

            try
            {
                DataSet ds = null;
                using (SqlConnection Connection = connection.returnConnection())
                {
                    using (SqlCommand command = new SqlCommand())
                    {
                        ds = new DataSet();
                        command.Connection  = Connection;
                        command.CommandText = "Sp_Sel_YakkrDetails";
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddWithValue("@agencyID", AgencyID);
                        SqlDataAdapter da = new SqlDataAdapter(command);
                        da.Fill(ds);
                    }
                }
                // yAKKR CODES
                if (ds.Tables[0].Rows.Count > 0)
                {
                    List <Yakkr.YakkrCode> _YakkrList = new List <Yakkr.YakkrCode>();
                    Yakkr.YakkrCode        obj        = null;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        obj            = new Yakkr.YakkrCode();
                        obj._YakkrID   = dr["Yakkrid"].ToString();
                        obj._YakkrCode = dr["YakkrCode"].ToString();
                        _YakkrList.Add(obj);
                    }
                    _staff.YakkrList = _YakkrList;
                }
                // roles
                if (ds.Tables[1].Rows.Count > 0)
                {
                    List <Yakkr.YakkrRoles> _YakkrList = new List <Yakkr.YakkrRoles>();
                    Yakkr.YakkrRoles        obj        = null;
                    foreach (DataRow dr in ds.Tables[1].Rows)
                    {
                        obj           = new Yakkr.YakkrRoles();
                        obj._RoleID   = dr["Id"].ToString();
                        obj._RoleName = dr["RoleName"].ToString();
                        _YakkrList.Add(obj);
                    }
                    _staff._YakkrRolesList = _YakkrList;
                }
                if (ds.Tables[2].Rows.Count > 0)
                {
                    List <Yakkr.YakkrAgencyCodes> _YakkrList = new List <Yakkr.YakkrAgencyCodes>();
                    Yakkr.YakkrAgencyCodes        obj        = null;
                    foreach (DataRow dr in ds.Tables[2].Rows)
                    {
                        obj               = new Yakkr.YakkrAgencyCodes();
                        obj.YakkrRoleID   = Convert.ToInt32(dr["YakkrRoleID"]);
                        obj.AgencyID      = dr["AgencyID"].ToString();
                        obj.YakkrID       = Convert.ToInt32(dr["YakkrID"]);
                        obj.YakkrCode     = dr["YakkrCode"].ToString();
                        obj.StaffRoleID   = dr["StaffRoleID"].ToString();
                        obj.StaffRoleName = dr["StaffRoleName"].ToString();
                        obj.Status        = dr["Status"].ToString();
                        obj.DateEntered   = Convert.ToDateTime(dr["DateEntered"].ToString());
                        obj.Value         = dr["Value"].ToString();
                        obj.Description   = dr["Description"].ToString();
                        _YakkrList.Add(obj);
                    }
                    _staff._YakkrAgencyCodes = _YakkrList;
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(_staff);
        }
Example #6
0
        public List <Yakkr> YakkrInfoDetails(out string totalrecord, string sortOrder, string sortDirection, string search, int skip, int pageSize, string userid)
        {
            List <Yakkr> _yakkrlist = new List <Yakkr>();

            try
            {
                totalrecord = string.Empty;
                string searchAgency = string.Empty;
                if (string.IsNullOrEmpty(search.Trim()))
                {
                    searchAgency = string.Empty;
                }
                else
                {
                    searchAgency = search;
                }
                command.Parameters.Add(new SqlParameter("@Search", searchAgency));
                command.Parameters.Add(new SqlParameter("@take", pageSize));
                command.Parameters.Add(new SqlParameter("@skip", skip));
                command.Parameters.Add(new SqlParameter("@sortcolumn", sortOrder));
                command.Parameters.Add(new SqlParameter("@sortorder", sortDirection));
                command.Parameters.Add(new SqlParameter("@agencyid", userid));
                command.Parameters.Add(new SqlParameter("@totalRecord", 0)).Direction = ParameterDirection.Output;
                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Sp_yakkrInfo";
                DataAdapter         = new SqlDataAdapter(command);
                yakkrdataTable      = new DataTable();
                DataAdapter.Fill(yakkrdataTable);
                if (yakkrdataTable.Rows.Count > 0)
                {
                    for (int i = 0; i < yakkrdataTable.Rows.Count; i++)
                    {
                        Yakkr addYakkrRow = new Yakkr();
                        addYakkrRow.YakkrRoleID = Convert.ToInt32(yakkrdataTable.Rows[i]["YakkrRoleID"]);
                        //addYakkrRow.YakkrID = Convert.ToString(yakkrdataTable.Rows[i]["YakkrID"]);
                        addYakkrRow.YakkrID         = Convert.ToString(yakkrdataTable.Rows[i]["YakkrCode"]);
                        addYakkrRow.Description     = Convert.ToString(yakkrdataTable.Rows[i]["Description"]);
                        addYakkrRow.Value           = Convert.ToString(yakkrdataTable.Rows[i]["Value"]);
                        addYakkrRow.StaffRoleID     = Convert.ToString(yakkrdataTable.Rows[i]["StaffRoleID"]);
                        addYakkrRow.SecondaryRoleID = Convert.ToString(yakkrdataTable.Rows[i]["OptionalRoleID"]);
                        addYakkrRow.StaffRoleName   = Convert.ToString(yakkrdataTable.Rows[i]["StaffRoleName"]);
                        if (Convert.ToString(yakkrdataTable.Rows[i]["OptionalRole"]) != null)
                        {
                            addYakkrRow.OptionalRoleName = Convert.ToString(yakkrdataTable.Rows[i]["OptionalRole"]);
                        }
                        else
                        {
                            addYakkrRow.OptionalRoleName = string.Empty;
                        }
                        addYakkrRow.DateEntered = Convert.ToDateTime(yakkrdataTable.Rows[i]["DateEntered"]).ToString("MM/dd/yyyy");

                        _yakkrlist.Add(addYakkrRow);
                    }
                    totalrecord = command.Parameters["@totalRecord"].Value.ToString();
                }
                return(_yakkrlist);
            }
            catch (Exception ex)
            {
                totalrecord = string.Empty;
                clsError.WriteException(ex);
                return(_yakkrlist);
            }
            finally
            {
                DataAdapter.Dispose();
                command.Dispose();
                yakkrdataTable.Dispose();
            }
        }