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


C# SqlParameter.ToArray方法代码示例

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


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

示例1: BatchAdd

        public static bool BatchAdd(string UserIDs, string date, decimal Duration, bool InWell, int NightWork, out string Message)
        {
            SqlParameter[] parameters = new SqlParameter[5];
            parameters[0] = new SqlParameter("@UserIDs", SqlDbType.Text);
            parameters[0].Value = UserIDs;
            parameters[1] = new SqlParameter("@Date", SqlDbType.VarChar, 20);
            parameters[1].Value = date;
            parameters[2] = new SqlParameter("@Duration", SqlDbType.Decimal);
            parameters[2].Value = Duration;
            parameters[3] = new SqlParameter("@InWell", SqlDbType.Int);
            parameters[3].Value = InWell ? 1 : 0;
            parameters[4] = new SqlParameter("@NightWork", SqlDbType.Int);
            parameters[4].Value = NightWork;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("SELECT DISTINCT userId FROM AttendanceMng");
            sql.AppendLine("WHERE DATE = @Date AND userId IN (SELECT value FROM dbo.sfTableFromItemList(@UserIDs))");
            DataTable table = helper.ExecuteDataTable(sql.ToString(), parameters.ToArray());
            StringBuilder userIDs = new StringBuilder();
            foreach (DataRow row in table.Rows) {
                if (userIDs.Length > 0) { userIDs.Append(","); }
                userIDs.Append(row["userId"].ToString().Trim());
            }
            Message = userIDs.Length > 0 ? userIDs.ToString() : "";

            int rowCount = 0;
            if (Message.Length == 0) {
                sql.Clear();
                sql.AppendLine("INSERT INTO AttendanceMng (userId, DATE, workDurs, ifIn, nightWork)");
                sql.AppendLine("SELECT value, @Date, @Duration, @InWell, @NightWork FROM dbo.sfTableFromItemList(@UserIDs)");
                rowCount = (int)helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray());
            }
            return rowCount > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:34,代码来源:AttendanceDao.cs

示例2: UpdateConsented

        public void UpdateConsented(long patientId,string fileExt)
        {
            SqlParameter[] sqlParms = new SqlParameter[]{
                         new SqlParameter("Id",patientId),
                         new SqlParameter("Ext",fileExt)
                    };

            SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, "UpdateConsented", sqlParms.ToArray());
        }
开发者ID:roshnisushanth,项目名称:Ignite_MHT,代码行数:9,代码来源:HickChatEngine.svc.cs

示例3: AddSummary

        public long AddSummary(string PeerId, string UserId)
        {
            SqlParameter[] sqlParms = new SqlParameter[]{
                new SqlParameter("UserId",Convert.ToInt64(UserId)),
                new SqlParameter("PeerId",Convert.ToInt64(PeerId))
            };

            var newId = SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, "Encounters_AddSummary", sqlParms.ToArray());

            return (long)newId;
        }
开发者ID:roshnisushanth,项目名称:Ignite_MHT,代码行数:11,代码来源:EncounterService.svc.cs

示例4: Add

        public static bool Add(DeptInfo dept)
        {
            SqlParameter[] parameters = new SqlParameter[4];
            parameters[0] = new SqlParameter("@ID", SqlDbType.Int);
            parameters[0].Value = dept.ID;
            parameters[1] = new SqlParameter("@Name", SqlDbType.VarChar, 50);
            parameters[1].Value = dept.Name;
            parameters[2] = new SqlParameter("@UpID", SqlDbType.Int);
            parameters[2].Value = dept.UpID;
            parameters[3] = new SqlParameter("@Level", SqlDbType.Int);
            parameters[3].Value = dept.Level;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("INSERT INTO DeptInfo (deptId, deptName, upID, [level])");
            sql.AppendLine("VALUES (@ID, @Name, @UpID, @Level)");
            int rowCount = helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray());
            return rowCount > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:18,代码来源:DeptDao.cs

示例5: DeleteMedication

        public void DeleteMedication(string Id)
        {
            SqlParameter[] sqlParms = new SqlParameter[]{
                new SqlParameter("Id",Convert.ToInt64(Id))
            };

            SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, "Encounters_DeleteMedication", sqlParms.ToArray());
        }
开发者ID:roshnisushanth,项目名称:Ignite_MHT,代码行数:8,代码来源:EncounterService.svc.cs

示例6: EditBabyPCP

        public void EditBabyPCP(long babyPCPId, string Name, string Address1, string Address2, string Phone, string City, string State, string ZipCode)
        {
            SqlParameter[] sqlParms = new SqlParameter[]{
                new SqlParameter("Id",babyPCPId),
                new SqlParameter("Name",Name),
                new SqlParameter("Address1",Address1),
                new SqlParameter("Address2",Address2),
                new SqlParameter("Phone",Phone),
                new SqlParameter("City",City),
                new SqlParameter("State",State),
                new SqlParameter("ZipCode",ZipCode)
            };

            SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, "Encounters_EditBabyPCP", sqlParms.ToArray());
        }
开发者ID:roshnisushanth,项目名称:Ignite_MHT,代码行数:15,代码来源:EncounterService.svc.cs

示例7: ForceCloseRFQ

        public static void ForceCloseRFQ(int RFQID)
        {
            List<RFQDetail> rfqdetails = RFQManager.GetDetail(RFQID);
            if (rfqdetails.Count > 0)
            {
                RFQDetail rfqdetail = rfqdetails[0];
                if (rfqdetail.RFQID > 0)
                {

                    WF.WFTemplate wf = new WF.WFTemplate("DefaultWF", rfqdetail == null ? 0 : rfqdetail.RFQID);
                    if (rfqdetail.HitRateStatus != "Pending" && string.IsNullOrEmpty(rfqdetail.HitRateStatus) == false && wf.CurrentActivity.ID != 7 && rfqdetail.RFQID > 0)
                    {

                        string strsql1 = "update SGP_RFQ set ActivityID=7,StatusID=9 where [email protected]";

                        string strsql2 = "insert into SYS_WFProcessLog select @RFQID,1,@FromActivityID,@ToActivityID,0,GetDate(),@UserID,@Comment";

                        SqlParameter[] sp1 = new SqlParameter[] { new SqlParameter("@RFQID", rfqdetail.RFQID) };

                        SqlParameter[] sp2 = new SqlParameter[] { new SqlParameter("@RFQID",rfqdetail.RFQID),
                                                                  new SqlParameter("@FromActivityID",wf.CurrentActivity.ID),
                                                                  new SqlParameter("@ToActivityID",7),
                                                                  new SqlParameter("@UserID", BI.SGP.BLL.Utils.AccessControl.CurrentLogonUser.Uid),
                                                                  new SqlParameter("@Comment", "Force Close RFQ")};

                        DbHelperSQL.ExecuteSql(strsql1, sp1.ToArray());
                        DbHelperSQL.ExecuteSql(strsql2, sp2.ToArray());
                    }

                }
            }
        }
开发者ID:rivernli,项目名称:SGP,代码行数:32,代码来源:RFQManager.cs

示例8: Update

        public static bool Update(RankInfo rank)
        {
            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0] = new SqlParameter("@ID", SqlDbType.Int);
            parameters[0].Value = rank.ID;
            parameters[1] = new SqlParameter("@Name", SqlDbType.VarChar, 30);
            parameters[1].Value = rank.Name;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE RankInfo SET Rank = @Name");
            sql.AppendLine("WHERE ID = @ID");
            int rowCount = helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray());
            return rowCount > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:14,代码来源:RankDao.cs

示例9: Update

        public static bool Update(AttendanceInfo attendance)
        {
            SqlParameter[] parameters = new SqlParameter[5];
            parameters[0] = new SqlParameter("@Date", SqlDbType.VarChar, 20);
            parameters[0].Value = attendance.Date;
            parameters[1] = new SqlParameter("@Duration", SqlDbType.Decimal);
            parameters[1].Value = attendance.Duration;
            parameters[2] = new SqlParameter("@InWell", SqlDbType.Int);
            parameters[2].Value = attendance.InWell ? 1 : 0;
            parameters[3] = new SqlParameter("@NightWork", SqlDbType.Int);
            parameters[3].Value = attendance.NightWork;
            parameters[4] = new SqlParameter("@ID", SqlDbType.Int);
            parameters[4].Value = attendance.ID;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE AttendanceMng SET DATE = @Date, workDurs = @Duration, ifIn = @InWell, nightWork = @NightWork");
            sql.AppendLine("WHERE ID = @ID");
            int rowCount = helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray());
            return rowCount > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:20,代码来源:AttendanceDao.cs

示例10: CreateIgniteContact

        public bool CreateIgniteContact(Contact contact)
        {
            SqlParameter[] sqlParms = new SqlParameter[]{
                new SqlParameter("FirstName",contact.FirstName),
                new SqlParameter("UserName",(Convert.ToString(contact.FirstName).Substring(0, 1) + Convert.ToString(contact.LastName)).ToLower().Trim()),
                new SqlParameter("LastName",contact.LastName),
                new SqlParameter("DOB",contact.DOB),
                new SqlParameter("ProviderId",contact.ProviderId),
                new SqlParameter("PhysicianId",contact.PhysicianId),
                new SqlParameter("ReferenceId",contact.ReferenceId),
                new SqlParameter("PhoneNumber",contact.PhoneNumber),
                new SqlParameter("EmailId",contact.Email),
                new SqlParameter("Password",contact.Password)
            };

            int ret = (int)SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, "SignUp_CreateNewContact", sqlParms.ToArray());

            if (ret > 0)
            {
                return true;
            }
            return false;
        }
开发者ID:roshnisushanth,项目名称:Ignite_MHT,代码行数:23,代码来源:SignUpService.svc.cs

示例11: AssignVVIData

        public SystemMessages AssignVVIData(int ID, string suppliercode, SystemMessages sysmgs)
        {
            this.ID = ID;
            //SystemMessages sysmgs = new SystemMessages();

            try
            {
                string strField = "", strValue = "";
                FieldInfoCollecton supplierfields = FieldCategory.GetAllFields(FieldCategory.Category_TYPE_SGPFORSUPPLIER);
                string number = "";
                foreach (FieldInfo fi in AllMasterFields)
                {
                    number += fi.FieldName == "Number" ? fi.DataValue.ToString() + "-" + suppliercode : "";

                    foreach (FieldInfo supplierfi in supplierfields)
                    {
                        if (fi.DisplayName == supplierfi.DisplayName)
                        {
                            if (supplierfi.FieldName == "NVARCHAR1")
                            {
                                fi.DataValue = number;
                                strField += supplierfi.FieldName + ",";
                                strValue += "'" + number + "',";
                            }

                            else
                            {
                                strField += supplierfi.FieldName + ",";
                                strValue += "'" + fi.DataValue.ToString() + "',";
                            }
                        }
                    }
                }

                strField += "DATETIME2,";
                strValue += "GetDate(),";

                string vendorname = DbHelperSQL.GetSingle<string>("select SupplierName from SYS_Supplier where [email protected]", new SqlParameter("@SupplyCode",suppliercode));
                vendorname = suppliercode + "[" + vendorname + "]";

                strField += "NVARCHAR7,";
                strValue += "'" + vendorname + "',";

                strField = strField.TrimEnd(',');
                strValue = strValue.TrimEnd(',');
                bool existsRFQNumber = DbHelperSQL.Exists("select count(*) from SGP_SubData where [email protected] and EntityName='VVIDETAIL' ", new SqlParameter("@Number", number));
                if (existsRFQNumber == false)
                {
                    try
                    {
                        int maxdataindex = -1;
                        maxdataindex = DbHelperSQL.GetSingle<int>("select Max(DataIndex) from SGP_SubData where EntityID=" + ID.ToString() + " and EntityName='VVIDETAIL'");
                        maxdataindex++;
                        string strSql = "insert into SGP_SubData(DataIndex,EntityID,EntityName," + strField + ") values(" + maxdataindex.ToString() + "," + ID.ToString() + ",'VVIDETAIL'," + strValue + ")";
                        DbHelperSQL.ExecuteSql(strSql);
                        string vendormail = "";
                        try
                        {
                            WF.WFUser user = new WF.WFUser(suppliercode);
                            if (user != null)
                            {
                                vendormail = user.Email;
                            }
                            else
                            {
                                vendormail = "[email protected]";
                            }
                        }
                        catch
                        {
                            vendormail = "[email protected]";
                        }

                       // wf.Run();
                        sysmgs.isPass = true;
                        sysmgs.MessageType = "Success";
                        sysmgs.Messages.Add("OK", number);
                        BI.SGP.BLL.WF.WFTemplate wftemplate = new WF.WFTemplate("SUPPLIERWF", ID, number);
                        BI.SGP.BLL.WF.WFActivity wfactivity = wftemplate.FirstActivity;
                        BI.SGP.BLL.WF.Action.SendMailAction sendmail = new WF.Action.SendMailAction();
                        sendmail.DoActionForVVI(wfactivity, vendorname, vendormail);

                        string strsql1 = "update SGP_RFQForVVI set ActivityID=102 where (ActivityID in(101) or ActivityID is null) and [email protected]";

                        string strsql2 = "insert into SYS_WFProcessLog select @RFQID,3,@FromActivityID,@ToActivityID,0,GetDate(),@UserID,@Comment";

                        SqlParameter[] sp1 = new SqlParameter[] { new SqlParameter("@RFQID", ID) };

                        SqlParameter[] sp2 = new SqlParameter[] { new SqlParameter("@RFQID",ID),
                                                                  new SqlParameter("@FromActivityID",101),
                                                                  new SqlParameter("@ToActivityID",102),
                                                                  new SqlParameter("@UserID", BI.SGP.BLL.Utils.AccessControl.CurrentLogonUser.Uid),
                                                                  new SqlParameter("@Comment", "Assign RFQ")};

                        DbHelperSQL.ExecuteSql(strsql1, sp1.ToArray());
                        DbHelperSQL.ExecuteSql(strsql2, sp2.ToArray());

                        AddHistory();
                    }
                    catch (Exception ex)
//.........这里部分代码省略.........
开发者ID:rivernli,项目名称:SGP,代码行数:101,代码来源:DetailModelBase.cs

示例12: Update

        public static bool Update(LogonUserInfo user)
        {
            SqlParameter[] parameters = new SqlParameter[6];
            parameters[0] = new SqlParameter("@Code", SqlDbType.VarChar, 20);
            parameters[0].Value = user.Code;
            parameters[1] = new SqlParameter("@Password", SqlDbType.VarChar, 20);
            parameters[1].Value = user.Password;
            parameters[2] = new SqlParameter("@RoleType", SqlDbType.Int);
            parameters[2].Value = user.RoleType;
            parameters[3] = new SqlParameter("@DeptID", SqlDbType.Int);
            parameters[3].Value = user.DeptID >= 0 ? (object)user.DeptID : DBNull.Value;
            parameters[4] = new SqlParameter("@Flag", SqlDbType.Int);
            parameters[4].Value = user.Active ? 1 : 0;
            parameters[5] = new SqlParameter("@ID", SqlDbType.Int);
            parameters[5].Value = user.ID;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE LogonUser SET logonUser = @Code, passwd = @Password, roleType = @RoleType, depId = @DeptID, flag = @Flag");
            sql.AppendLine("WHERE ID = @ID");
            return helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray()) > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:21,代码来源:LogonUserDao.cs

示例13: Update

        public static bool Update(HolidayInfo holiday)
        {
            SqlParameter[] parameters = new SqlParameter[6];
            parameters[0] = new SqlParameter("@Name", SqlDbType.VarChar, 20);
            parameters[0].Value = holiday.Name;
            parameters[1] = new SqlParameter("@StartDate", SqlDbType.VarChar, 20);
            parameters[1].Value = holiday.StartDate;
            parameters[2] = new SqlParameter("@EndDate", SqlDbType.VarChar, 20);
            parameters[2].Value = holiday.EndDate;
            parameters[3] = new SqlParameter("@Flag", SqlDbType.Int);
            parameters[3].Value = holiday.Active ? 1 : 0;
            parameters[4] = new SqlParameter("@Days", SqlDbType.Int);
            parameters[4].Value = holiday.Days;
            parameters[5] = new SqlParameter("@ID", SqlDbType.Int);
            parameters[5].Value = holiday.ID;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE HolidayInfo SET holidayName = @Name, startDate = @StartDate, endDate = @EndDate, flag = @Flag, days = @Days");
            sql.AppendLine("WHERE ID = @ID");
            int rowCount = helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray());
            return rowCount > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:22,代码来源:HolidayDao.cs

示例14: UpdateCard

        public static bool UpdateCard(string ID, int CopyType)
        {
            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0] = new SqlParameter("@ID", SqlDbType.VarChar, 6);
            parameters[0].Value = ID;
            parameters[1] = new SqlParameter("@CopyType", SqlDbType.Int);
            parameters[1].Value = CopyType;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE UserInfo SET CopyType = @CopyType, flag = 0");
            sql.AppendLine("WHERE userId = @ID");
            int rowCount = helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray());
            return rowCount > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:14,代码来源:UserDao.cs

示例15: Update

        public static bool Update(UserInfo user)
        {
            SqlParameter[] parameters = new SqlParameter[6];
            parameters[0] = new SqlParameter("@ID", SqlDbType.VarChar, 6);
            parameters[0].Value = user.ID;
            parameters[1] = new SqlParameter("@Name", SqlDbType.VarChar, 10);
            parameters[1].Value = user.Name;
            parameters[2] = new SqlParameter("@DeptID", SqlDbType.Int);
            parameters[2].Value = user.DeptID;
            parameters[3] = new SqlParameter("@RankID", SqlDbType.Int);
            parameters[3].Value = user.RankID;
            parameters[4] = new SqlParameter("@SenderID", SqlDbType.VarChar, 6);
            parameters[4].Value = user.SenderID;
            parameters[5] = new SqlParameter("@Type", SqlDbType.Int);
            parameters[5].Value = user.Type;

            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE UserInfo SET userName = @Name");
            sql.AppendLine("	, deptId = @DeptID");
            sql.AppendLine("	, rankId = @RankID");
            sql.AppendLine("	, senderId = @SenderID");
            sql.AppendLine("	, [type] = @Type");
            sql.AppendLine("WHERE userId = @ID");
            int rowCount = helper.ExecuteNonQuery(sql.ToString(), parameters.ToArray());
            return rowCount > 0;
        }
开发者ID:weihongji,项目名称:FRAS,代码行数:26,代码来源:UserDao.cs


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