private ProjectInfo GetModel()
        {
            ProjectInfo projectInfo = new ProjectInfo();

            projectInfo.ProjectName = txtProjectName.Text.Trim();
            projectInfo.CreatedUserId = LoginUser.UserId;
            projectInfo.CreateDate = DateTime.Now;
            projectInfo.ModiftyUserId = LoginUser.UserId;
            projectInfo.ModiftyDate = DateTime.Now;
            projectInfo.CustomerId = Convert.ToInt32(ddlCustomerList.SelectedValue);
            projectInfo.BussinessUserId = Convert.ToInt32(hidUserId.Value);
            return projectInfo;
        }
Esempio n. 2
0
        public ProjectInfo GetProjectById(int projectId)
        {
            ProjectInfo projectInfo = new ProjectInfo();

            ProjectDal dal = new ProjectDal();

            DataSet ds = dal.GetProjectById(projectId);

            if(ds!=null &&ds.Tables.Count>0&&ds.Tables[0].Rows.Count>0)
            {
                projectInfo = ConvertToModel(ds.Tables[0].Rows[0]);
            }

            return projectInfo;
        }
Esempio n. 3
0
        public void Add(ProjectInfo projectInfo)
        {
            string sql = "   insert into P_Project(ProjectName,CreatedUserId,CreateDate,CustomerId,BussinessUserId) values(@ProjectName,@CreatedUserId,@CreateDate,@CustomerId,@BussinessUserId)";

            List<SqlParameter> lstParamter = new List<SqlParameter>();

            SqlParameter paramter = new SqlParameter("@ProjectName", projectInfo.ProjectName);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@CreatedUserId", projectInfo.CreatedUserId);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@CreateDate", projectInfo.CreateDate);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@CustomerId", projectInfo.CustomerId);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@BussinessUserId", projectInfo.BussinessUserId);
            lstParamter.Add(paramter);

            SQLHelp.ExecuteNonQuery(sql, lstParamter);
        }
Esempio n. 4
0
        public void Update(ProjectInfo projectInfo)
        {
            string sql = "  update P_Project set ProjectName = @ProjectName, ModiftyUserId = @ModiftyUserId, ModiftyDate = @ModiftyDate, CustomerId = @CustomerId, BussinessUserId = @BussinessUserId ";
            sql += " where ProjectId =@ProjectId";

            List<SqlParameter> lstParamter = new List<SqlParameter>();

            SqlParameter paramter = new SqlParameter("@ProjectName", projectInfo.ProjectName);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@ModiftyUserId", projectInfo.ModiftyUserId);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@ModiftyDate", projectInfo.ModiftyDate);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@CustomerId", projectInfo.CustomerId);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@BussinessUserId", projectInfo.BussinessUserId);
            lstParamter.Add(paramter);
            paramter = new SqlParameter("@ProjectId", projectInfo.ProjectId);
            lstParamter.Add(paramter);

            SQLHelp.ExecuteNonQuery(sql, lstParamter);
        }
Esempio n. 5
0
        private ProjectInfo ConvertToModel(DataRow dr)
        {
            ProjectInfo projectInfo = new ProjectInfo();

            if(dr!=null)
            {
                if(dr["ProjectId"] is DBNull ==false)
                {
                    int projectId = 0;
                    int.TryParse(dr["ProjectId"].ToString(), out projectId);

                    projectInfo.ProjectId = projectId;
                }

                if (dr["ProjectName"] is DBNull == false)
                {

                    projectInfo.ProjectName = dr["ProjectName"].ToString();
                }

                if (dr["CreatedUserId"] is DBNull == false)
                {
                    int createdUserId = 0;
                    int.TryParse(dr["CreatedUserId"].ToString(), out createdUserId);

                    projectInfo.CreatedUserId = createdUserId;
                }

                if (dr["CreateDate"] is DBNull == false)
                {
                    DateTime createDate = DateTime.MaxValue;
                    DateTime.TryParse(dr["CreateDate"].ToString(), out createDate);

                    projectInfo.CreateDate = createDate;
                }

                if (dr["ModiftyUserId"] is DBNull == false)
                {
                    int modiftyUserId = 0;
                    int.TryParse(dr["ModiftyUserId"].ToString(), out modiftyUserId);

                    projectInfo.ModiftyUserId = modiftyUserId;
                }

                if (dr["ModiftyDate"] is DBNull == false)
                {
                    DateTime modiftyDate = DateTime.MaxValue;
                    DateTime.TryParse(dr["ModiftyDate"].ToString(), out modiftyDate);

                    projectInfo.ModiftyDate = modiftyDate;
                }

                if (dr["CustomerId"] is DBNull == false)
                {
                    int customerId = 0;
                    int.TryParse(dr["CustomerId"].ToString(), out customerId);

                    projectInfo.CustomerId = customerId;
                }

                if (dr["BussinessUserId"] is DBNull == false)
                {
                    int bussinessUserId = 0;
                    int.TryParse(dr["BussinessUserId"].ToString(), out bussinessUserId);

                    projectInfo.BussinessUserId = bussinessUserId;
                }

                if (dr["ResponseUserId"] is DBNull == false)
                {
                    int responseUserId = 0;
                    int.TryParse(dr["ResponseUserId"].ToString(), out responseUserId);

                    projectInfo.ResponseUserId = responseUserId;
                }
            }
            return projectInfo;
        }
Esempio n. 6
0
        public void Update(ProjectInfo projectInfo)
        {
            ProjectDal dal = new ProjectDal();

            dal.Update(projectInfo);
        }
Esempio n. 7
0
        public void Add(ProjectInfo projectInfo)
        {
            ProjectDal dal = new ProjectDal();

            dal.Add(projectInfo);
        }