当前位置: 首页>>代码示例>>C#>>正文


C# DataLayer.Update方法代码示例

本文整理汇总了C#中DataLayer.Update方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.Update方法的具体用法?C# DataLayer.Update怎么用?C# DataLayer.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataLayer的用法示例。


在下文中一共展示了DataLayer.Update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApproveDoctor

 public void ApproveDoctor(String docUsername, string connString)
 {
     SqlParameter dUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50);
     dUsername.Value = docUsername;
     SqlCommand cmdSql = new SqlCommand();
     cmdSql.CommandType = CommandType.StoredProcedure;
     cmdSql.CommandText = "usp_ApproveDoctor";
     cmdSql.Parameters.Add(dUsername);
     DataLayer datalayerObj = new DataLayer();
     cmdSql = datalayerObj.Update(cmdSql, connString);
 }
开发者ID:san2488,项目名称:medicopedia,代码行数:11,代码来源:BusinessLayer.cs

示例2: UpdateQueryStatus

        //update query status to needs more info
        public void UpdateQueryStatus(int queryId, string connString)
        {
            SqlParameter pQueryId = new SqlParameter("@QueryId", SqlDbType.Int);
            SqlParameter pQueryStatus = new SqlParameter("@Status", SqlDbType.VarChar, 30);
            pQueryId.Value = queryId;
            pQueryStatus.Value = "Needs More Info";

            SqlCommand cmdSql = new SqlCommand();

            cmdSql.CommandType = CommandType.StoredProcedure;
            cmdSql.CommandText = "usp_UpdateQueryStatus";

            cmdSql.Parameters.Add(pQueryId);

            DataLayer dataLayerObj = new DataLayer();
            dataLayerObj.Update(cmdSql, connString);
        }
开发者ID:san2488,项目名称:medicopedia,代码行数:18,代码来源:BusinessLayer.cs

示例3: UpdateQuery

        public void UpdateQuery(Query queryObj, string connString)
        {
            SqlParameter pQueryId = new SqlParameter("@QueryId", SqlDbType.Int);
            SqlParameter pUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50);
            SqlParameter pQueryAreaOfInterest = new SqlParameter("@QueryAreaOfInterest", SqlDbType.NVarChar, 100);
            SqlParameter pSymptoms = new SqlParameter("@Symptoms", SqlDbType.NVarChar, 200);
            SqlParameter pMedicalHistory = new SqlParameter("@MedicalHistory", SqlDbType.NVarChar, 500);
            SqlParameter pStatus = new SqlParameter("@Status", SqlDbType.NVarChar, 20);
            SqlParameter pIsAttendedTo = new SqlParameter("@IsAttendedTo", SqlDbType.Bit);
            SqlParameter pPostedDateTime = new SqlParameter("@PostedDateTime", SqlDbType.DateTime);

            pQueryId.Direction = ParameterDirection.Output;
            pQueryAreaOfInterest.Value = queryObj.QueryAreaOfInterest;
            pUsername.Value = queryObj.Username;
            pSymptoms.Value = queryObj.Symptoms;
            pMedicalHistory.Value = queryObj.MedicalHistory;
            pStatus.Value = queryObj.Status;

            //the boolean value
            pIsAttendedTo.Value = queryObj.IsAttendedTo;

            //the date time value
            pPostedDateTime.Value = queryObj.PostedDatetime;

            //adding params to query
            SqlCommand cmdSql = new SqlCommand();
            cmdSql.CommandType = CommandType.StoredProcedure;
            cmdSql.CommandText = "usp_UpdateQuery";

            cmdSql.Parameters.Add(pQueryAreaOfInterest);
            cmdSql.Parameters.Add(pUsername);
            cmdSql.Parameters.Add(pSymptoms);
            cmdSql.Parameters.Add(pMedicalHistory);
            cmdSql.Parameters.Add(pStatus);
            cmdSql.Parameters.Add(pIsAttendedTo);
            cmdSql.Parameters.Add(pPostedDateTime);
            cmdSql.Parameters.Add(pQueryId);

            DataLayer datalayerObj = new DataLayer();
            datalayerObj.Update(cmdSql, connString);
            queryObj.QueryId = int.Parse(pQueryId.Value.ToString());
        }
开发者ID:san2488,项目名称:medicopedia,代码行数:42,代码来源:BusinessLayer.cs

示例4: UpdateComment

 public void UpdateComment(Comments commentObj, string connectionString)
 {
     SqlParameter pCommentId = new SqlParameter("@CommentId", SqlDbType.Int, 0);
     SqlParameter pCommentField = new SqlParameter("@CommentsField", SqlDbType.NVarChar, 100);
     pCommentId.Value = commentObj.CommentId;
     pCommentField.Value = commentObj.CommentsField;
     SqlCommand cmd = new SqlCommand();
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.CommandText = "usp_UpdateUserSubmittedComment";
     cmd.Parameters.Add(pCommentId);
     cmd.Parameters.Add(pCommentField);
     DataLayer dataLayerObj = new DataLayer();
     cmd = dataLayerObj.Update(cmd, connectionString);
 }
开发者ID:san2488,项目名称:medicopedia,代码行数:14,代码来源:BusinessLayer.cs

示例5: InsertAdvice

        public Advice InsertAdvice(Advice adviceObj, string connString)
        {
            //declaration of parameters
            string errorMessage;

            if (isValidAdvice(adviceObj, out errorMessage))
            {
                SqlParameter pQueryId = new SqlParameter("@QueryId", SqlDbType.Int);
                SqlParameter pUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50);
                SqlParameter pLikes = new SqlParameter("@Likes", SqlDbType.Int);
                SqlParameter pDislikes = new SqlParameter("@Dislikes", SqlDbType.Int);
                SqlParameter pAdviceDescription = new SqlParameter("@AdviceDescription", SqlDbType.NVarChar, 400);
                SqlParameter pAdviceTitle = new SqlParameter("@AdviceTitle", SqlDbType.NVarChar, 50);
                SqlParameter pAdviceDateTime = new SqlParameter("@AdviceDateTime", SqlDbType.DateTime);

                //initialization
                pQueryId.Value = adviceObj.QueryId;
                pUsername.Value = adviceObj.Username;
                pLikes.Value = adviceObj.Likes;
                pDislikes.Value = adviceObj.Dislikes;
                pAdviceDescription.Value = adviceObj.AdviceDescription;
                pAdviceTitle.Value = adviceObj.AdviceTitle;
                pAdviceDateTime.Value = adviceObj.AdviceDateTime;

                //adding params to query
                SqlCommand cmdSql = new SqlCommand();
                cmdSql.CommandType = CommandType.StoredProcedure;
                cmdSql.CommandText = "usp_InsertAdvice";

                cmdSql.Parameters.Add(pQueryId);
                cmdSql.Parameters.Add(pUsername);
                cmdSql.Parameters.Add(pLikes);
                cmdSql.Parameters.Add(pDislikes);
                cmdSql.Parameters.Add(pAdviceDescription);
                cmdSql.Parameters.Add(pAdviceTitle);
                cmdSql.Parameters.Add(pAdviceDateTime);

                //storage in data layer
                DataLayer datalayerObj = new DataLayer();
                cmdSql = datalayerObj.Insert(cmdSql, connString);

                //updating query status 'IsAttendedTo'
                SqlParameter pIsAttendedTo = new SqlParameter("@IsAttendedTo", SqlDbType.Bit);
                SqlParameter pStatus = new SqlParameter("@Status", SqlDbType.VarChar, 30);
                SqlParameter pQuery1 = new SqlParameter("@QueryId", SqlDbType.Int);
                pQuery1.Value = pQueryId.Value;
                pIsAttendedTo.Value = true;
                pStatus.Value = "Answered";

                //first command
                SqlCommand cmdSql1 = new SqlCommand();

                cmdSql1.CommandType = CommandType.StoredProcedure;
                cmdSql1.CommandText = "usp_UpdateQueryAttended";

                cmdSql1.Parameters.Add(pQuery1);
                cmdSql1.Parameters.Add(pIsAttendedTo);

                datalayerObj = new DataLayer();
                cmdSql1 = datalayerObj.Update(cmdSql1, connString);

                //second command
                SqlCommand cmdSql2 = new SqlCommand();
                cmdSql2.CommandType = CommandType.StoredProcedure;
                cmdSql2.CommandText = "usp_UpdateQueryStatus";

                cmdSql2.Parameters.Add(pStatus);

                datalayerObj = new DataLayer();
                cmdSql2 = datalayerObj.Update(cmdSql2, connString);
            }

            else
            {
                throw new Exception(errorMessage);
            }
            return adviceObj;
        }
开发者ID:san2488,项目名称:medicopedia,代码行数:78,代码来源:BusinessLayer.cs


注:本文中的DataLayer.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。