Beispiel #1
0
        public objResponse UpdateProject(Project.Entity.Projects objProjects, string LogedUser, string Field)
        {
            objResponse Response = new objResponse();

            try
            {
                SqlParameter[] sqlParameter = new SqlParameter[9];

                sqlParameter[0]       = new SqlParameter("@Date", SqlDbType.Date, 50);
                sqlParameter[0].Value = objProjects.Date;

                sqlParameter[1]       = new SqlParameter("@Title", SqlDbType.NVarChar, 200);
                sqlParameter[1].Value = objProjects.Title;

                sqlParameter[2]       = new SqlParameter("@Client_ID", SqlDbType.BigInt, 10);
                sqlParameter[2].Value = objProjects.Client_ID;

                sqlParameter[3]       = new SqlParameter("@Model", SqlDbType.NVarChar, 30);
                sqlParameter[3].Value = objProjects.Model;

                sqlParameter[4]       = new SqlParameter("@Category_ID", SqlDbType.BigInt, 10);
                sqlParameter[4].Value = objProjects.Category_ID;

                sqlParameter[5]       = new SqlParameter("@CreatedBy", SqlDbType.NVarChar, 60);
                sqlParameter[5].Value = LogedUser;

                sqlParameter[6]       = new SqlParameter("@CreatedDate", SqlDbType.DateTime, 50);
                sqlParameter[6].Value = DateTime.Now;

                sqlParameter[7]       = new SqlParameter("@Project_ID_PK", SqlDbType.BigInt, 10);
                sqlParameter[7].Value = objProjects.Project_ID_PK;

                sqlParameter[8]       = new SqlParameter("@Field", SqlDbType.NVarChar, 100);
                sqlParameter[8].Value = Field;



                DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_UpdateEProject", sqlParameter, DB_CONSTANTS.ConnectionString_ERP_CRUZATA);


                if (Response.ResponseData.Tables[0].Rows.Count > 0)
                {
                    Response.ErrorCode    = 0;
                    Response.ErrorMessage = Response.ResponseData.Tables[0].Rows[0][0].ToString();
                }
                else
                {
                    Response.ErrorCode    = 2001;
                    Response.ErrorMessage = "There is an Error. Please Try After some time.";
                }
            }
            catch (Exception ex)
            {
                Response.ErrorCode    = 3001;
                Response.ErrorMessage = ex.Message.ToString();
                BAL.Common.LogManager.LogError("UpdateProject", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace));
            }
            return(Response);
        }
Beispiel #2
0
        public List <Project.Entity.Projects> getProjects()
        {
            objResponse Response = new objResponse();
            List <Project.Entity.Projects> projects = new List <Project.Entity.Projects>();

            try
            {
                DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetProjects", DB_CONSTANTS.ConnectionString_ERP_CRUZATA);


                if (Response.ResponseData.Tables[0].Rows.Count > 0)
                {
                    Response.ErrorCode = 0;
                    foreach (DataRow dr in Response.ResponseData.Tables[0].Rows)
                    {
                        Project.Entity.Projects objProjects = new Project.Entity.Projects();
                        objProjects.Project_ID_PK = Convert.ToInt64(dr["Project_ID_Auto_PK"]);
                        objProjects.Title         = Convert.ToString(dr["Title"]);
                        objProjects.Date          = Convert.ToDateTime(dr["Date"]);
                        objProjects.CategoryName  = Convert.ToString(dr["CategoryName"]);
                        objProjects.ClientName    = Convert.ToString(dr["Name"]);
                        objProjects.Model         = Convert.ToString(dr["Model"]);
                        objProjects.Status        = Convert.ToString(dr["Status"]);
                        objProjects.ProjectCost   = Convert.ToString(dr["ProjectCost"]);
                        if (Convert.ToString(dr["ClientSign"]) != "")
                        {
                            objProjects.isSigned = true;
                        }
                        else
                        {
                            objProjects.isSigned = false;
                        }
                        projects.Add(objProjects);
                    }
                }
                else
                {
                    Response.ErrorCode    = 2001;
                    Response.ErrorMessage = "There is an Error. Please Try After some time.";
                }
            }
            catch (Exception ex)
            {
                Response.ErrorCode    = 3001;
                Response.ErrorMessage = ex.Message.ToString();
                BAL.Common.LogManager.LogError("getProject", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace));
            }
            return(projects);
        }