Exemplo n.º 1
0
 public string CreateGroup(GroupDetails obj)
 {
     try
     {
         U_USR_GroupsDAL ocontactsDAL = new U_USR_GroupsDAL();
         U_USR_Groups    ogroup       = new U_USR_Groups();
         ogroup.Group_Id     = Guid.NewGuid().ToString();
         ogroup.Group_Name   = obj.Group_Name;
         ogroup.Group_Source = "";
         ogroup.Group_Status = "1";
         ogroup.Usr_Id       = obj.User_Id;
         ogroup.Updated_by   = "";
         ogroup.Updated_Date = DateTime.Now;
         ogroup.Created_by   = "";
         ogroup.Created_Date = DateTime.Now;
         ogroup.Group_Desc   = "";
         bool status = ocontactsDAL.InsertU_USR_Groups(ogroup);
         if (status == true)
         {
             return("1");
         }
         else
         {
             return("0");
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
         return(null);
     }
 }
Exemplo n.º 2
0
 private void SetParameters(SqlParameter[] U_USR_GroupsParms, U_USR_Groups tobjU_USR_Groups)
 {
     U_USR_GroupsParms[0].Value = tobjU_USR_Groups.Group_Id;
     U_USR_GroupsParms[1].Value = tobjU_USR_Groups.Usr_Id;
     U_USR_GroupsParms[2].Value = tobjU_USR_Groups.Group_Name;
     U_USR_GroupsParms[3].Value = tobjU_USR_Groups.Group_Desc;
     U_USR_GroupsParms[4].Value = tobjU_USR_Groups.Group_Source;
     U_USR_GroupsParms[5].Value = tobjU_USR_Groups.Group_Status;
     U_USR_GroupsParms[6].Value = tobjU_USR_Groups.Created_Date;
     U_USR_GroupsParms[7].Value = tobjU_USR_Groups.Updated_Date;
     U_USR_GroupsParms[8].Value = tobjU_USR_Groups.Created_by;
     U_USR_GroupsParms[9].Value = tobjU_USR_Groups.Updated_by;
 }
Exemplo n.º 3
0
 public bool InsertU_USR_Groups(U_USR_Groups tobjU_USR_Groups)
 {
     if (tobjU_USR_Groups != null)
     {
         //Get the parameter list needed by the given object
         SqlParameter[] lParamArray = GetParameters(tobjU_USR_Groups);
         SetParameters(lParamArray, tobjU_USR_Groups);
         //Get the connection
         SqlConnection con = General.GetConnection();
         if (con == null)
         {
             //Connection is not created
             return(false);
         }
         //Execute the insertion
         int i = SqlHelper.ExecuteNonQuery(
             con,
             CommandType.Text,
             SQL_INSERT_U_USR_Groups,
             lParamArray);
         //Dispose the Sql connection
         con.Dispose();
         if (i == 1)
         {
             //Done and insert the object to the table
             return(true);
         }
         else
         {
             //Fail to execute the insertion
             return(false);
         }
     }
     else
     {
         //No object found to insert
         return(false);
     }
 }
Exemplo n.º 4
0
 private SqlParameter[] GetParameters(U_USR_Groups tobjU_USR_Groups)
 {
     SqlParameter[] objParamArray = SqlHelperParameterCache.GetCachedParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_USR_Groups);
     if (objParamArray == null)
     {
         //Represents a parameter to a System.Data.SqlClient.SqlCommand,
         //and optionally, its mapping to System.Data.DataSet columns.
         objParamArray = new SqlParameter[]
         {
             new SqlParameter(PARAM_Group_Id, tobjU_USR_Groups.Group_Id),
             new SqlParameter(PARAM_Usr_Id, tobjU_USR_Groups.Usr_Id),
             new SqlParameter(PARAM_Group_Name, tobjU_USR_Groups.Group_Name),
             new SqlParameter(PARAM_Group_Desc, tobjU_USR_Groups.Group_Desc),
             new SqlParameter(PARAM_Group_Source, tobjU_USR_Groups.Group_Source),
             new SqlParameter(PARAM_Group_Status, tobjU_USR_Groups.Group_Status),
             new SqlParameter(PARAM_Created_Date, tobjU_USR_Groups.Created_Date),
             new SqlParameter(PARAM_Updated_Date, tobjU_USR_Groups.Updated_Date),
             new SqlParameter(PARAM_Created_by, tobjU_USR_Groups.Created_by),
             new SqlParameter(PARAM_Updated_by, tobjU_USR_Groups.Updated_by),
         };
         SqlHelperParameterCache.CacheParameterSet(General.SQL_CONN_STRING, SQL_INSERT_U_USR_Groups, objParamArray);
     }
     return(objParamArray);
 }