Exemplo n.º 1
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.ProfessionalPlan model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into ProfessionalPlan(");
            strSql.Append("Pro_Year,Pro_SubmitTime,Pro_Professional,Pro_Curriculum,Pro_Content)");
            strSql.Append(" values (");
            strSql.Append("@Pro_Year,@Pro_SubmitTime,@Pro_Professional,@Pro_Curriculum,@Pro_Content)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Pro_Year", SqlDbType.Int,4),
                    new SqlParameter("@Pro_SubmitTime", SqlDbType.DateTime),
                    new SqlParameter("@Pro_Professional", SqlDbType.Int,4),
                    new SqlParameter("@Pro_Curriculum", SqlDbType.Int,4),
                    new SqlParameter("@Pro_Content", SqlDbType.Text)};
            parameters[0].Value = model.Pro_Year;
            parameters[1].Value = model.Pro_SubmitTime;
            parameters[2].Value = model.Pro_Professional;
            parameters[3].Value = model.Pro_Curriculum;
            parameters[4].Value = model.Pro_Content;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 2
0
        public void Insert(LabMS.Model.VoteJson voteJson)
        {
            LabMS.Model.Vote voteInfo = new LabMS.Model.Vote();

            voteInfo.VoteTitle = voteJson.Title;
            voteInfo.VoteStartTime = DateTime.Now;

            voteInfo.VoteLimit = voteJson.Limit;

            voteInfo.key = base.Add(voteInfo); // Insert vote

            foreach (LabMS.Model.VoteItemJson item in voteJson.Items)
            {
                LabMS.Model.VoteItem voteItemInfo = new LabMS.Model.VoteItem();
                LabMS.BLL.VoteItem voteItem = new LabMS.BLL.VoteItem();
                voteItemInfo.VoteID = voteInfo.key;
                voteItemInfo.VoteItemContent = item.Title;

                voteItemInfo.key = voteItem.Add(voteItemInfo); // Insert Item

                foreach (LabMS.Model.VoteAnswerJson answer in item.Answers)
                {
                    LabMS.Model.VoteAnswer voteAnswerInfo = new LabMS.Model.VoteAnswer();
                    LabMS.BLL.VoteAnswer voteAnswer = new LabMS.BLL.VoteAnswer();

                    voteAnswerInfo.VoteItemID = voteItemInfo.key;
                    voteAnswerInfo.VoteAnswerContent = answer.Name;

                    voteAnswer.Add(voteAnswerInfo); // Insert answer
                }
            }
        }
Exemplo n.º 3
0
        public void Insert(List<LabMS.Model.ResearchProject> models, LabMS.Model.ResearchImportType type)
        {
            if (models.Count < 1) { return; }

            if (type == LabMS.Model.ResearchImportType.Add)
            {
                foreach (LabMS.Model.ResearchProject model in models)
                {
                    base.Add(model);
                }
            }
            else if (type == LabMS.Model.ResearchImportType.RecoverAdd)
            {
                foreach (LabMS.Model.ResearchProject model in models)
                {
                    RecoverAdd(model);
                }
            }
            else
            {
                DeleteAll();

                foreach (LabMS.Model.ResearchProject model in models)
                {
                    base.Add(model);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.VoteRecordDetail model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into VoteRecordDetail(");
            strSql.Append("VoteRecordID,VoteItemID,VoteAnswerID)");
            strSql.Append(" values (");
            strSql.Append("@VoteRecordID,@VoteItemID,@VoteAnswerID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@VoteRecordID", SqlDbType.Int,4),
                    new SqlParameter("@VoteItemID", SqlDbType.Int,4),
                    new SqlParameter("@VoteAnswerID", SqlDbType.Int,4)};
            parameters[0].Value = model.VoteRecordID;
            parameters[1].Value = model.VoteItemID;
            parameters[2].Value = model.VoteAnswerID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Responsibility model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Responsibility(");
            strSql.Append("Resp_Lab,Resp_Name,Resp_Content,Intro,Summary)");
            strSql.Append(" values (");
            strSql.Append("@Resp_Lab,@Resp_Name,@Resp_Content,@Intro,@Summary)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Resp_Lab", SqlDbType.Int,4),
                    new SqlParameter("@Resp_Name", SqlDbType.VarChar,50),
                    new SqlParameter("@Resp_Content", SqlDbType.VarChar,200),
                    new SqlParameter("@Intro", SqlDbType.VarChar,100),
                    new SqlParameter("@Summary", SqlDbType.VarChar,200)};
            parameters[0].Value = model.Resp_Lab;
            parameters[1].Value = model.Resp_Name;
            parameters[2].Value = model.Resp_Content;
            parameters[3].Value = model.Intro;
            parameters[4].Value = model.Summary;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.CourseTiming model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into CourseTiming(");
            strSql.Append("Nub,STime,ETime,����)");
            strSql.Append(" values (");
            strSql.Append("@Nub,@STime,@ETime,@����)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Nub", SqlDbType.Int,4),
                    new SqlParameter("@STime", SqlDbType.DateTime),
                    new SqlParameter("@ETime", SqlDbType.DateTime),
                    new SqlParameter("@����", SqlDbType.Int,4)};
            parameters[0].Value = model.Nub;
            parameters[1].Value = model.STime;
            parameters[2].Value = model.ETime;
            parameters[3].Value = model.����;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// ��֤����
        /// </summary>
        /// <param name="json"></param>
        private void ValidateVote(LabMS.Model.VoteRecordJson json)
        {
            ExtendBLL.Vote vote = new ExtendBLL.Vote();
            LabMS.Model.Vote voteInfo = vote.GetModel(json.VoteID);

            if (voteInfo == null)
            {
                throw new Exception("���������Ѿ�ʧЧ");
            }

            bool exists = false;

            switch (voteInfo.VoteLimit)
            {
                case 0:
                    break;
                case 1: // ÿIPһ��
                    exists = Exist(" [IP]='" + json.IP + "' and [VoteID]=" + json.VoteID);
                    if (exists)
                    {
                        throw new Exception("�Բ���ÿ��IPֻ�ܲ���һ������!");
                    }
                    break;
                case 2:
                    exists = Exist(" [UserID]=" + json.UserID + " and [VoteID]=" + json.VoteID + " and [UserType] = " + json.UserType);
                    if (exists)
                    {
                        throw new Exception("�Բ������Ѿ��������������������!");
                    }
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.PostReply model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into PostReply(");
            strSql.Append("PostReplyContent,PosterID,PostReplyTime,ReplierID,ReplierType)");
            strSql.Append(" values (");
            strSql.Append("@PostReplyContent,@PosterID,@PostReplyTime,@ReplierID,@ReplierType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@PostReplyContent", SqlDbType.Text),
                    new SqlParameter("@PosterID", SqlDbType.Int,4),
                    new SqlParameter("@PostReplyTime", SqlDbType.DateTime),
                    new SqlParameter("@ReplierID", SqlDbType.Int,4),
                    new SqlParameter("@ReplierType", SqlDbType.Int,4)};
            parameters[0].Value = model.PostReplyContent;
            parameters[1].Value = model.PosterID;
            parameters[2].Value = model.PostReplyTime;
            parameters[3].Value = model.ReplierID;
            parameters[4].Value = model.ReplierType;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.ValuablesAnnualBenefitEvaluation model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into ValuablesAnnualBenefitEvaluation(");
            strSql.Append("Numbers,Comment,Years,Score,Operator,OperatDate,Effective,Fixed,IndependentlyNub,GuidanceNub,ExperimentNub,InternationalAwards,MinisterialAwards,ColonelAward,CorePublications,OutSchool,InSchool,MakeUse,OriginalFunctional,IncreaseFunctional)");
            strSql.Append(" values (");
            strSql.Append("@Numbers,@Comment,@Years,@Score,@Operator,@OperatDate,@Effective,@Fixed,@IndependentlyNub,@GuidanceNub,@ExperimentNub,@InternationalAwards,@MinisterialAwards,@ColonelAward,@CorePublications,@OutSchool,@InSchool,@MakeUse,@OriginalFunctional,@IncreaseFunctional)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Numbers", SqlDbType.VarChar,50),
                    new SqlParameter("@Comment", SqlDbType.VarChar,100),
                    new SqlParameter("@Years", SqlDbType.VarChar,20),
                    new SqlParameter("@Score", SqlDbType.VarChar,20),
                    new SqlParameter("@Operator", SqlDbType.VarChar,30),
                    new SqlParameter("@OperatDate", SqlDbType.DateTime),
                    new SqlParameter("@Effective", SqlDbType.Int,4),
                    new SqlParameter("@Fixed", SqlDbType.Int,4),
                    new SqlParameter("@IndependentlyNub", SqlDbType.Int,4),
                    new SqlParameter("@GuidanceNub", SqlDbType.Int,4),
                    new SqlParameter("@ExperimentNub", SqlDbType.Int,4),
                    new SqlParameter("@InternationalAwards", SqlDbType.Int,4),
                    new SqlParameter("@MinisterialAwards", SqlDbType.Int,4),
                    new SqlParameter("@ColonelAward", SqlDbType.Int,4),
                    new SqlParameter("@CorePublications", SqlDbType.Int,4),
                    new SqlParameter("@OutSchool", SqlDbType.Int,4),
                    new SqlParameter("@InSchool", SqlDbType.Int,4),
                    new SqlParameter("@MakeUse", SqlDbType.Int,4),
                    new SqlParameter("@OriginalFunctional", SqlDbType.Int,4),
                    new SqlParameter("@IncreaseFunctional", SqlDbType.Int,4)};
            parameters[0].Value = model.Numbers;
            parameters[1].Value = model.Comment;
            parameters[2].Value = model.Years;
            parameters[3].Value = model.Score;
            parameters[4].Value = model.Operator;
            parameters[5].Value = model.OperatDate;
            parameters[6].Value = model.Effective;
            parameters[7].Value = model.Fixed;
            parameters[8].Value = model.IndependentlyNub;
            parameters[9].Value = model.GuidanceNub;
            parameters[10].Value = model.ExperimentNub;
            parameters[11].Value = model.InternationalAwards;
            parameters[12].Value = model.MinisterialAwards;
            parameters[13].Value = model.ColonelAward;
            parameters[14].Value = model.CorePublications;
            parameters[15].Value = model.OutSchool;
            parameters[16].Value = model.InSchool;
            parameters[17].Value = model.MakeUse;
            parameters[18].Value = model.OriginalFunctional;
            parameters[19].Value = model.IncreaseFunctional;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Evaluation model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Evaluation(");
            strSql.Append("Comment,Result,Remark,LabID,Date,StandarID,EvTime)");
            strSql.Append(" values (");
            strSql.Append("@Comment,@Result,@Remark,@LabID,@Date,@StandarID,@EvTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Comment", SqlDbType.Text),
                    new SqlParameter("@Result", SqlDbType.Int,4),
                    new SqlParameter("@Remark", SqlDbType.Text),
                    new SqlParameter("@LabID", SqlDbType.Int,4),
                    new SqlParameter("@Date", SqlDbType.DateTime),
                    new SqlParameter("@StandarID", SqlDbType.Int,4),
                    new SqlParameter("@EvTime", SqlDbType.Int,4)};
            parameters[0].Value = model.Comment;
            parameters[1].Value = model.Result;
            parameters[2].Value = model.Remark;
            parameters[3].Value = model.LabID;
            parameters[4].Value = model.Date;
            parameters[5].Value = model.StandarID;
            parameters[6].Value = model.EvTime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.AttachmentItem model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into AttachmentItem(");
            strSql.Append("Item_Address,Attach_ID,Item_Name,Item_Type)");
            strSql.Append(" values (");
            strSql.Append("@Item_Address,@Attach_ID,@Item_Name,@Item_Type)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Item_Address", SqlDbType.VarChar,150),
                    new SqlParameter("@Attach_ID", SqlDbType.Int,4),
                    new SqlParameter("@Item_Name", SqlDbType.VarChar,100),
                    new SqlParameter("@Item_Type", SqlDbType.VarChar,50)};
            parameters[0].Value = model.Item_Address;
            parameters[1].Value = model.Attach_ID;
            parameters[2].Value = model.Item_Name;
            parameters[3].Value = model.Item_Type;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.EvaluationTitle model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into EvaluationTitle(");
            strSql.Append("Title_Code,Title_Name,Title_Author,Title_SubmitDate,Title_ModifyDate,Title_Category,LabID)");
            strSql.Append(" values (");
            strSql.Append("@Title_Code,@Title_Name,@Title_Author,@Title_SubmitDate,@Title_ModifyDate,@Title_Category,@LabID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Title_Code", SqlDbType.VarChar,50),
                    new SqlParameter("@Title_Name", SqlDbType.VarChar,100),
                    new SqlParameter("@Title_Author", SqlDbType.VarChar,20),
                    new SqlParameter("@Title_SubmitDate", SqlDbType.DateTime),
                    new SqlParameter("@Title_ModifyDate", SqlDbType.DateTime),
                    new SqlParameter("@Title_Category", SqlDbType.Int,4),
                    new SqlParameter("@LabID", SqlDbType.Int,4)};
            parameters[0].Value = model.Title_Code;
            parameters[1].Value = model.Title_Name;
            parameters[2].Value = model.Title_Author;
            parameters[3].Value = model.Title_SubmitDate;
            parameters[4].Value = model.Title_ModifyDate;
            parameters[5].Value = model.Title_Category;
            parameters[6].Value = model.LabID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 13
0
        public void Bind(LabMS.Model.InstrumentAndConsumables mvaluables)
        {
            EquipPhoto.ImageUrl = "~/Equipment/PicShow.aspx?ID=" + mvaluables.ID;
            tbInstrumentNum.Text = mvaluables.Numbers;
            tbKindNum.Text = mvaluables.ClassNumber;
            tbInstrumentName.Text = mvaluables.Name;
            tbStandards.Text = mvaluables.Standards;
            tbModel.Text = mvaluables.Model;
            tbCountryCode.Text = mvaluables.CountryCode;
            tbAmount.Text = mvaluables.Quantity.ToString();
            tbUnitPrice.Text = mvaluables.UnitPrice;
            tbFactoryCode.Text = mvaluables.FactoryCode;
            tbDocuments.Text = mvaluables.Documents;
            tbMeasurement.Text = mvaluables.Measurement;
            try
            {
                tbProductionDate.Text = mvaluables.ProductionDate.Value.ToShortDateString();
                tbPurchaseDate.Text = mvaluables.PurchaseDate.Value.ToShortDateString();
                tbOpeningTime.Text = mvaluables.OpeningTime.Value.ToShortDateString();
                tbCreatedDate.Text = mvaluables.CreatedDate.Value.ToShortDateString();
            }
            catch { }

            tbResponesoblePerson.Text = mvaluables.ResponesoblePerson;
            tbContactPhone.Text = mvaluables.ContactPhone;
            tbCharges.Text = mvaluables.Charges;
            tbZipCode.Text = mvaluables.ZipCode;
            tbMailingAddress.Text =  mvaluables.MailingAddress;
            tbPurpose.Text = mvaluables.Purpose;
        }
Exemplo n.º 14
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.CourseDesign model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into CourseDesign(");
            strSql.Append("ScoreID,Design_Name,Design_Credit,Design_EndTime,Design_Summary)");
            strSql.Append(" values (");
            strSql.Append("@ScoreID,@Design_Name,@Design_Credit,@Design_EndTime,@Design_Summary)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@ScoreID", SqlDbType.Int,4),
                    new SqlParameter("@Design_Name", SqlDbType.VarChar,30),
                    new SqlParameter("@Design_Credit", SqlDbType.Int,4),
                    new SqlParameter("@Design_EndTime", SqlDbType.DateTime),
                    new SqlParameter("@Design_Summary", SqlDbType.Text)};
            parameters[0].Value = model.ScoreID;
            parameters[1].Value = model.Design_Name;
            parameters[2].Value = model.Design_Credit;
            parameters[3].Value = model.Design_EndTime;
            parameters[4].Value = model.Design_Summary;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// ������ǩ������ID�����ǩ�Ѿ����ڣ��򷵻�ԭ��ǩID
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddGet(LabMS.Model.Tag model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("if exists(select null from [Tag] where [TagName] = @TagName) ");
            strSql.Append("select [key] from [Tag] where [TagName] = @TagName ");
            strSql.Append("else begin ");
            strSql.Append("insert into Tag(");
            strSql.Append("TagName)");
            strSql.Append(" values (");
            strSql.Append("@TagName)");
            strSql.Append(";select @@IDENTITY");
            strSql.Append(" end");
            SqlParameter[] parameters = {
                new SqlParameter("@TagName", SqlDbType.VarChar,50)};
            parameters[0].Value = model.TagName;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Post model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Post(");
            strSql.Append("PostTitle,PosterID,PostContent,PostRecordTime,PosterType,PostPlateID,ViewTimes)");
            strSql.Append(" values (");
            strSql.Append("@PostTitle,@PosterID,@PostContent,@PostRecordTime,@PosterType,@PostPlateID,@ViewTimes)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@PostTitle", SqlDbType.VarChar,100),
                    new SqlParameter("@PosterID", SqlDbType.Int,4),
                    new SqlParameter("@PostContent", SqlDbType.Text),
                    new SqlParameter("@PostRecordTime", SqlDbType.DateTime),
                    new SqlParameter("@PosterType", SqlDbType.Int,4),
                    new SqlParameter("@PostPlateID", SqlDbType.Int,4),
                    new SqlParameter("@ViewTimes", SqlDbType.Int,4)};
            parameters[0].Value = model.PostTitle;
            parameters[1].Value = model.PosterID;
            parameters[2].Value = model.PostContent;
            parameters[3].Value = model.PostRecordTime;
            parameters[4].Value = model.PosterType;
            parameters[5].Value = model.PostPlateID;
            parameters[6].Value = model.ViewTimes;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Semester model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Semester(");
            strSql.Append("Year,MSemester,STime,ETime)");
            strSql.Append(" values (");
            strSql.Append("@Year,@MSemester,@STime,@ETime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Year", SqlDbType.Int,4),
                    new SqlParameter("@MSemester", SqlDbType.Int,4),
                    new SqlParameter("@STime", SqlDbType.DateTime),
                    new SqlParameter("@ETime", SqlDbType.DateTime)};
            parameters[0].Value = model.Year;
            parameters[1].Value = model.MSemester;
            parameters[2].Value = model.STime;
            parameters[3].Value = model.ETime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Class model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Class(");
            strSql.Append("Class_Code,Class_Name,Class_Year,Class_StudentNum,Class_Professional)");
            strSql.Append(" values (");
            strSql.Append("@Class_Code,@Class_Name,@Class_Year,@Class_StudentNum,@Class_Professional)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Class_Code", SqlDbType.VarChar,50),
                    new SqlParameter("@Class_Name", SqlDbType.VarChar,50),
                    new SqlParameter("@Class_Year", SqlDbType.VarChar,30),
                    new SqlParameter("@Class_StudentNum", SqlDbType.Int,4),
                    new SqlParameter("@Class_Professional", SqlDbType.Int,4)};
            parameters[0].Value = model.Class_Code;
            parameters[1].Value = model.Class_Name;
            parameters[2].Value = model.Class_Year;
            parameters[3].Value = model.Class_StudentNum;
            parameters[4].Value = model.Class_Professional;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// ������ۼ�¼
        /// </summary>
        /// <param name="json">json</param>
        /// <param name="ip">IP</param>
        public void Insert(LabMS.Model.VoteRecordJson json)
        {
            if (json == null)
            {
                throw new Exception("�����ύ�յļ�¼");
            }

            ValidateVote(json);

            LabMS.Model.VoteRecord voteRecordInfo = new LabMS.Model.VoteRecord();
            voteRecordInfo.IP = json.IP;
            voteRecordInfo.UserID = json.UserID;
            voteRecordInfo.VoteID = json.VoteID;
            voteRecordInfo.UserType = json.UserType;
            voteRecordInfo.VoteTime = DateTime.Now;

            voteRecordInfo.ID = base.Add(voteRecordInfo); // insert vote record

            foreach (LabMS.Model.VoteRecordDetailJson detail in json.Details)
            {
                LabMS.Model.VoteRecordDetail vrdInfo = new LabMS.Model.VoteRecordDetail();
                LabMS.BLL.VoteRecordDetail vrd = new LabMS.BLL.VoteRecordDetail();

                vrdInfo.VoteAnswerID = detail.VoteAnswerID;
                vrdInfo.VoteItemID = detail.VoteItemID;
                vrdInfo.VoteRecordID = voteRecordInfo.ID;

                vrd.Add(vrdInfo); // Insert detail
            }
        }
Exemplo n.º 20
0
        public int Insert(LabMS.Model.FavoriteResource model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("if exists(select null from FavoriteResource where UserID=@UserID and ResourceID=@ResourceID and UserType=@UserType) return; else begin ");
            strSql.Append("insert into FavoriteResource(");
            strSql.Append("UserID,ResourceID,UserType)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@ResourceID,@UserType)");
            strSql.Append(";select @@IDENTITY; end");
            SqlParameter[] parameters = {
                    new SqlParameter("@UserID", SqlDbType.Int,4),
                    new SqlParameter("@ResourceID", SqlDbType.Int,4),
                    new SqlParameter("@UserType", SqlDbType.Int,4)};
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.ResourceID;
            parameters[2].Value = model.UserType;

            object obj = Maticsoft.DBUtility.DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.VoteRecord model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into VoteRecord(");
            strSql.Append("VoteID,UserID,IP,VoteTime,UserType)");
            strSql.Append(" values (");
            strSql.Append("@VoteID,@UserID,@IP,@VoteTime,@UserType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@VoteID", SqlDbType.Int,4),
                    new SqlParameter("@UserID", SqlDbType.Int,4),
                    new SqlParameter("@IP", SqlDbType.VarChar,20),
                    new SqlParameter("@VoteTime", SqlDbType.DateTime),
                    new SqlParameter("@UserType", SqlDbType.Int, 4)};
            parameters[0].Value = model.VoteID;
            parameters[1].Value = model.UserID;
            parameters[2].Value = model.IP;
            parameters[3].Value = model.VoteTime;
            parameters[4].Value = model.UserType;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.ProjectAppointment model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into ProjectAppointment(");
            strSql.Append("OP_Appoint_ID,Appoint_ProID,Appoint_ClassID,OP_ProjectCode,OP_Score)");
            strSql.Append(" values (");
            strSql.Append("@OP_Appoint_ID,@Appoint_ProID,@Appoint_ClassID,@OP_ProjectCode,@OP_Score)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@OP_Appoint_ID", SqlDbType.VarChar,50),
                    new SqlParameter("@Appoint_ProID", SqlDbType.Int,4),
                    new SqlParameter("@Appoint_ClassID", SqlDbType.VarChar,50),
                    new SqlParameter("@OP_ProjectCode", SqlDbType.VarChar,50),
                    new SqlParameter("@OP_Score", SqlDbType.VarChar,50)};
            parameters[0].Value = model.OP_Appoint_ID;
            parameters[1].Value = model.Appoint_ProID;
            parameters[2].Value = model.Appoint_ClassID;
            parameters[3].Value = model.OP_ProjectCode;
            parameters[4].Value = model.OP_Score;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.PersonalProjConsume model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into PersonalProjConsume(");
            strSql.Append("PersonalProjID,EquipName,EquipType,EquipNum,Introduction)");
            strSql.Append(" values (");
            strSql.Append("@PersonalProjID,@EquipName,@EquipType,@EquipNum,@Introduction)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@PersonalProjID", SqlDbType.Int,4),
                    new SqlParameter("@EquipName", SqlDbType.VarChar,50),
                    new SqlParameter("@EquipType", SqlDbType.Int,4),
                    new SqlParameter("@EquipNum", SqlDbType.Int,4),
                    new SqlParameter("@Introduction", SqlDbType.VarChar,500)};
            parameters[0].Value = model.PersonalProjID;
            parameters[1].Value = model.EquipName;
            parameters[2].Value = model.EquipType;
            parameters[3].Value = model.EquipNum;
            parameters[4].Value = model.Introduction;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Standard model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Standard(");
            strSql.Append("St_Num,St_Content,St_Standard,St_Method,St_Explain,St_Date,EvTitleID)");
            strSql.Append(" values (");
            strSql.Append("@St_Num,@St_Content,@St_Standard,@St_Method,@St_Explain,@St_Date,@EvTitleID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@St_Num", SqlDbType.VarChar,50),
                    new SqlParameter("@St_Content", SqlDbType.VarChar,200),
                    new SqlParameter("@St_Standard", SqlDbType.Text),
                    new SqlParameter("@St_Method", SqlDbType.Text),
                    new SqlParameter("@St_Explain", SqlDbType.Text),
                    new SqlParameter("@St_Date", SqlDbType.DateTime),
                    new SqlParameter("@EvTitleID", SqlDbType.Int,4)};
            parameters[0].Value = model.St_Num;
            parameters[1].Value = model.St_Content;
            parameters[2].Value = model.St_Standard;
            parameters[3].Value = model.St_Method;
            parameters[4].Value = model.St_Explain;
            parameters[5].Value = model.St_Date;
            parameters[6].Value = model.EvTitleID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.PostPlate model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into PostPlate(");
            strSql.Append("ParentID,Name,Description)");
            strSql.Append(" values (");
            strSql.Append("@ParentID,@Name,@Description)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@ParentID", SqlDbType.Int,4),
                    new SqlParameter("@Name", SqlDbType.VarChar,50),
                    new SqlParameter("@Description", SqlDbType.VarChar,500)};
            parameters[0].Value = model.ParentID;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.Description;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 26
0
        public void bindDDL(LabMS.Model.OpentProject mopproject)
        {
            LabMS.BLL.Lab blab = new LabMS.BLL.Lab();
            List<LabMS.Model.Lab> mLab = new List<LabMS.Model.Lab>();
            mLab = blab.GetModelList(" Lab_ParentID is null ");
            ddlLabName.DataSource = mLab;
            ddlLabName.DataTextField = "Lab_Name";
            ddlLabName.DataValueField = "Lab_Code";
            ddlLabName.DataBind();
            ddlLabName.SelectedValue = mopproject.Project_Lab;

            ExtendBLL.Dictionary eDictionary = new ExtendBLL.Dictionary();
            List<Model.Dictionary> listCClass = new List<LabMS.Model.Dictionary>();

            listCClass = eDictionary.GetItemListByDClass("shiyanleibie");
            ddlProjectCategory.DataSource = listCClass;
            ddlProjectCategory.DataTextField = "Name";
            ddlProjectCategory.DataValueField = "Code";
            ddlProjectCategory.DataBind();
            ddlProjectCategory.SelectedValue = mopproject.Project_Category;

            listCClass = eDictionary.GetItemListByDClass("shiyanleixing");
            ddlProjectType.DataSource = listCClass;
            ddlProjectType.DataTextField = "Name";
            ddlProjectType.DataValueField = "Code";
            ddlProjectType.DataBind();
            ddlProjectType.SelectedValue = mopproject.Project_Type;

            listCClass = eDictionary.GetItemListByDClass("shiyanyaoqiu");
            ddlProjectRequire.DataSource = listCClass;
            ddlProjectRequire.DataTextField = "Name";
            ddlProjectRequire.DataValueField = "Code";
            ddlProjectRequire.DataBind();
            ddlProjectRequire.SelectedValue = mopproject.Project_Require;

            listCClass = eDictionary.GetItemListByDClass("shiyanzheleibie");
            ddlProjectPartnerType.DataSource = listCClass;
            ddlProjectPartnerType.DataTextField = "Name";
            ddlProjectPartnerType.DataValueField = "Code";
            ddlProjectPartnerType.DataBind();
            ddlProjectPartnerType.SelectedValue = mopproject.Project_PartnerType;

            listCClass = eDictionary.GetItemListByDClass("shiyanxiangmulaiyuan");
            ddlProjectComFrom.DataSource = listCClass;
            ddlProjectComFrom.DataTextField = "Name";
            ddlProjectComFrom.DataValueField = "Code";
            ddlProjectComFrom.DataBind();
            ddlProjectComFrom.SelectedValue = mopproject.OP_ProSource;

            LabMS.Model.SysSetting msys = new LabMS.Model.SysSetting();
            ExtendBLL.SysSetting extendsys = new ExtendBLL.SysSetting();
            msys = extendsys.GetCurrentSetting();
            List<string> listYear = Common.GradeHelper.GetCurrentGrade((int)msys.CurrentYear, (int)msys.CurrentSemester, false);
            ddlOPGrade.DataSource = listYear;
            ddlOPGrade.DataBind();
            ddlOPGrade.Items.Insert(0, new ListItem("", "0"));
            ddlOPGrade.SelectedValue = mopproject.OP_Grade;

            ddlOPFunds.SelectedValue = mopproject.OP_Funds;
        }
Exemplo n.º 27
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Vote model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Vote(");
            strSql.Append("VoteTitle,VoteStartTime,VoteLimit)");
            strSql.Append(" values (");
            strSql.Append("@VoteTitle,@VoteStartTime,@VoteLimit)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@VoteTitle", SqlDbType.VarChar,200),
                    new SqlParameter("@VoteStartTime", SqlDbType.DateTime),
                    new SqlParameter("@VoteLimit", SqlDbType.Int,4)};
            parameters[0].Value = model.VoteTitle;
            parameters[1].Value = model.VoteStartTime;
            parameters[2].Value = model.VoteLimit;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Fuction model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Fuction(");
            strSql.Append("Code,Name,MCode)");
            strSql.Append(" values (");
            strSql.Append("@Code,@Name,@MCode)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Code", SqlDbType.VarChar,20),
                    new SqlParameter("@Name", SqlDbType.VarChar,50),
                    new SqlParameter("@MCode", SqlDbType.VarChar,20)};
            parameters[0].Value = model.Code;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.MCode;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.ScoreConversion model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into ScoreConversion(");
            strSql.Append("Percentile,Percentile2,Level)");
            strSql.Append(" values (");
            strSql.Append("@Percentile,@Percentile2,@Level)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Percentile", SqlDbType.Float,8),
                    new SqlParameter("@Percentile2", SqlDbType.Float,8),
                    new SqlParameter("@Level", SqlDbType.VarChar,20)};
            parameters[0].Value = model.Percentile;
            parameters[1].Value = model.Percentile2;
            parameters[2].Value = model.Level;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(LabMS.Model.Professional model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Professional(");
            strSql.Append("Pro_Code,Pro_Name,Pro_EnglishName,Pro_Education)");
            strSql.Append(" values (");
            strSql.Append("@Pro_Code,@Pro_Name,@Pro_EnglishName,@Pro_Education)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Pro_Code", SqlDbType.VarChar,100),
                    new SqlParameter("@Pro_Name", SqlDbType.VarChar,100),
                    new SqlParameter("@Pro_EnglishName", SqlDbType.VarChar,50),
                    new SqlParameter("@Pro_Education", SqlDbType.VarChar,100)};
            parameters[0].Value = model.Pro_Code;
            parameters[1].Value = model.Pro_Name;
            parameters[2].Value = model.Pro_EnglishName;
            parameters[3].Value = model.Pro_Education;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }