Exemplo n.º 1
0
        public static void CleanTest(string vid)
        {
            var sql = "delete from VTestVM where VID = '<VID>'";

            sql = sql.Replace("<VID>", vid);
            DBUtility.ExeLocalSqlNoRes(sql);
        }
Exemplo n.º 2
0
        public static void AddBuyRequest(AssetBuyInfoVM buy)
        {
            var now   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            var sql   = @"insert into AssetBuyInfo (EngName, ChName, UnitPrice,
                    Brand, Model, OriginCountry, Picture, Purpose, Functions,
                    WorkPrinciple, CorporatePurposes, Status, CreateAt, UpdateAt) 
                    values (@EngName, @ChName, @UnitPrice,
                    @Brand, @Model, @OriginCountry, @Picture, @Purpose, @Functions,
                    @WorkPrinciple, @CorporatePurposes, @Status, @CreateAt, @UpdateAt)";
            var param = new Dictionary <string, string>();

            param.Add("@EngName", buy.EngName);
            param.Add("@ChName", buy.ChName);
            param.Add("@UnitPrice", buy.UnitPrice);
            param.Add("@Brand", buy.Brand);
            param.Add("@Model", buy.Model);
            param.Add("@OriginCountry", buy.OriginCountry);
            param.Add("@Picture", buy.Picture);
            param.Add("@Purpose", buy.Purpose);
            param.Add("@Functions", buy.Functions);
            param.Add("@WorkPrinciple", buy.WorkPrinciple);
            param.Add("@CorporatePurposes", buy.CorporatePurposes);
            param.Add("@Status", BuyStatus.Request.ToString());
            param.Add("@CreateAt", now);
            param.Add("@UpdateAt", now);

            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 3
0
        public static void WriteLog2(string uName, string machine, string url,
                                     string oModule, string op, string vId, int lType, VLog4NetLevel lLevel, string msg)
        {
            var ret = GetVideoLog(vId, "", uName);

            if (ret.Count > 0)
            {
                return;
            }
            var sql = "INSERT INTO [NPITrace].[dbo].[VideoLog] ([UserName],[Machine],[Url],[OperateModule],[Operate],[VideoID],[LogType],[LogLevel],[Message],[CreateAt]) VALUES (@uname, @machine, @url, @module, @operate, @vid, @ltype, @llevel, @msg, @date)";

            var dic = new Dictionary <string, string>();

            dic.Add("@uname", uName);
            dic.Add("@machine", machine);
            dic.Add("@url", url);
            dic.Add("@module", oModule);
            dic.Add("@operate", op);
            dic.Add("@vid", vId);
            dic.Add("@ltype", lType.ToString());
            dic.Add("@llevel", "INFO");
            dic.Add("@msg", msg);
            dic.Add("@date", DateTime.Now.ToString());

            DBUtility.ExeLocalSqlNoRes(sql, dic);
        }
Exemplo n.º 4
0
        public static void StoreUserScore(string ma, string iname, string vid, string cans, string uans, string usc)
        {
            var uname = iname.Split(new string[] { "@" }, StringSplitOptions.RemoveEmptyEntries)[0].ToUpper().Trim();

            MachineUserMap.TryAddMachineUserMap(ma, uname);

            if (ScoreExist(uname, vid).Count == 0)
            {
                var videos = TechVideoVM.RetrieveVideoByID(vid);
                if (videos.Count > 0)
                {
                    UpdateUserRank(uname, usc);

                    var sql   = @"insert into VTestScore(MACHINE,UserName,VID,VSubject,CorrectiveAnswer,UserAnswer,UserScore,UpdateTime)  
                                values(@MACHINE,@UserName,@VID,@VSubject,@CorrectiveAnswer,@UserAnswer,@UserScore,@UpdateTime)";
                    var param = new Dictionary <string, string>();
                    param.Add("@MACHINE", ma);
                    param.Add("@UserName", uname);
                    param.Add("@VID", vid);
                    param.Add("@VSubject", videos[0].VSubject);
                    param.Add("@CorrectiveAnswer", cans);
                    param.Add("@UserAnswer", uans);
                    param.Add("@UserScore", usc);
                    param.Add("@UpdateTime", DateTime.Now.ToString());
                    DBUtility.ExeLocalSqlNoRes(sql, param);
                }
            }
        }
Exemplo n.º 5
0
        public static void NewBorrow(List <AssetBorrowHistoryVM> borrow)
        {
            var now   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            var sql   = @"insert into AssetBorrowHistory (RequestID, AssetID, BorrowUser, ProjectNo, 
                    IsLong, StartDate, EndDate, AdminConfirm, BorrowComment, IsReturn, ReturnComment,
                    ReturnAt, CreateAt, UpdateAt) values ";
            var param = new Dictionary <string, string>();
            var idx   = 0;

            foreach (var item in borrow)
            {
                sql += "( @RequestID_" + idx + ", @AssetID_" + idx + ", @BorrowUser_" + idx + ", @ProjectNo_" + idx + ", @IsLong_" + idx
                       + ", @StartDate_" + idx + ", @EndDate_" + idx + ", @AdminConfirm_" + idx + ", @BorrowComment_"
                       + idx + ", @IsReturn_" + idx + ", @ReturnComment_" + idx + ", @ReturnAt_" + idx + ", @CreateAt_" + idx + ", @UpdateAt_" + idx + "),";
                param.Add("@RequestID_" + idx, item.RequestID);
                param.Add("@AssetID_" + idx, item.AssetID);
                param.Add("@BorrowUser_" + idx, item.BorrowUser.ToUpper());
                param.Add("@ProjectNo_" + idx, item.ProjectNo);
                param.Add("@IsLong_" + idx, item.IsLong);
                param.Add("@StartDate_" + idx, item.StartDate);
                param.Add("@EndDate_" + idx, item.EndDate);
                param.Add("@AdminConfirm_" + idx, item.AdminConfirm);
                param.Add("@BorrowComment_" + idx, item.BorrowComment);
                param.Add("@IsReturn_" + idx, item.IsReturn);
                param.Add("@ReturnComment_" + idx, item.ReturnComment);
                param.Add("@ReturnAt_" + idx, item.ReturnAt);
                param.Add("@CreateAt_" + idx, now);
                param.Add("@UpdateAt_" + idx, now);
                idx++;
            }
            sql = sql.Substring(0, sql.Length - 1);

            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 6
0
        public static void UpdateUserRank(string UserName, string UserRank)
        {
            var sql = "select UserRank from VTestRank where UserName = '******'";

            sql = sql.Replace("<UserName>", UserName);
            var dbret = DBUtility.ExeLocalSqlWithRes(sql);

            if (dbret.Count == 0)
            {
                sql = "insert into VTestRank(UserName,UserRank,UpdateTime) values(@UserName,@UserRank,@UpdateTime)";
                var param = new Dictionary <string, string>();
                param.Add("@UserName", UserName);
                param.Add("@UserRank", UserRank);
                param.Add("@UpdateTime", DateTime.Now.ToString());
                DBUtility.ExeLocalSqlNoRes(sql, param);
            }
            else
            {
                var rank      = Convert.ToInt32(dbret[0][0]);
                var urank     = Convert.ToInt32(UserRank);
                var totalrank = rank + urank;
                if (totalrank < 0)
                {
                    totalrank = 0;
                }

                sql = "update VTestRank set UserRank = @UserRank,UpdateTime = @UpdateTime where UserName = @UserName";
                var param = new Dictionary <string, string>();
                param.Add("@UserName", UserName);
                param.Add("@UserRank", totalrank.ToString());
                param.Add("@UpdateTime", DateTime.Now.ToString());
                DBUtility.ExeLocalSqlNoRes(sql, param);
            }
        }
Exemplo n.º 7
0
        public static void BindMesTab(string PNKey, string whichtest)
        {
            var sql   = "update PnMESVM set Bind = 'TRUE'  where PNKey = @PNKey and WhichTest = @WhichTest";
            var param = new Dictionary <string, string>();

            param.Add("@PNKey", PNKey);
            param.Add("@WhichTest", whichtest);
            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 8
0
        public static void UpdataProductLineTestData(string DMRProdLine, Dictionary <string, DateTime> snstoredatedict)
        {
            var snlist = snstoredatedict.Keys.ToList();
            var sncond = "('" + string.Join("','", snlist) + "')";
            var sql    = @"select distinct ModuleSerialNum,WhichTest,ErrAbbr,TestTimeStamp FROM [NPITrace].[dbo].[ProjectTestData] where ModuleSerialNum in <sncond> order by ModuleSerialNum,TestTimeStamp desc";

            sql = sql.Replace("<sncond>", sncond);
            var sntestdict = new Dictionary <string, bool>();
            var ret        = new List <DMRSNTestData>();
            var dbret      = DBUtility.ExeLocalSqlWithRes(sql);

            foreach (var line in dbret)
            {
                var tempvm = new DMRSNTestData();
                tempvm.SN        = O2S(line[0]).ToUpper().Trim();
                tempvm.WhichTest = O2S(line[1]);
                tempvm.Failure   = O2S(line[2]);
                tempvm.TestTime  = O2T(line[3]);

                var sntestkey = tempvm.SN + ":" + tempvm.WhichTest;
                if (sntestdict.ContainsKey(sntestkey))
                {
                    continue;
                }
                else
                {
                    sntestdict.Add(sntestkey, true);
                }

                if (!string.IsNullOrEmpty(tempvm.TestTime) &&
                    DateTime.Parse(tempvm.TestTime) > snstoredatedict[tempvm.SN])
                {
                    ret.Add(tempvm);
                }
            }

            if (ret.Count > 0)
            {
                var dict = new Dictionary <string, string>();
                dict.Add("@DMRProdLine", DMRProdLine);
                sql = "delete from DMRSNTestData where DMRProdLine = @DMRProdLine";
                DBUtility.ExeLocalSqlNoRes(sql, dict);

                sql = "insert into DMRSNTestData(DMRProdLine,SN,WhichTest,Failure,TestTime) values(@DMRProdLine,@SN,@WhichTest,@Failure,@TestTime)";
                foreach (var item in ret)
                {
                    dict = new Dictionary <string, string>();
                    dict.Add("@DMRProdLine", DMRProdLine);
                    dict.Add("@SN", item.SN);
                    dict.Add("@WhichTest", item.WhichTest);
                    dict.Add("@Failure", item.Failure);
                    dict.Add("@TestTime", item.TestTime);
                    DBUtility.ExeLocalSqlNoRes(sql, dict);
                }
            }
        }
Exemplo n.º 9
0
 public static void CleanData(string w)
 {
     if (HasData(w))
     {
         var sql  = "delete from ProbeTestData where Wafer = @Wafer";
         var dict = new Dictionary <string, string>();
         dict.Add("@Wafer", w);
         DBUtility.ExeLocalSqlNoRes(sql, dict);
     }
 }
Exemplo n.º 10
0
        public static void NeverShowIE8Modal(string machine)
        {
            var sql = "delete from MachineLink where LinkName='' and ReqMachine = '<ReqMachine>' and Appv_1 <> ''";

            sql = sql.Replace("<ReqMachine>", machine);
            DBUtility.ExeLocalSqlNoRes(sql);
            sql = "insert into MachineLink(ReqMachine,Appv_1) values(N'<ReqMachine>','nevershow')";
            sql = sql.Replace("<ReqMachine>", machine);
            DBUtility.ExeLocalSqlNoRes(sql);
        }
Exemplo n.º 11
0
        private static void UpdateReviewTimes(string id, string shareto, int times)
        {
            var sql  = "update SnapFileVM set ReviewTimes=@ReviewTimes where DocID=@DocID and ShareTo=@ShareTo";
            var dict = new Dictionary <string, string>();

            dict.Add("@DocID", id);
            dict.Add("@ShareTo", shareto);
            dict.Add("@ReviewTimes", times.ToString());
            DBUtility.ExeLocalSqlNoRes(sql, dict);
        }
Exemplo n.º 12
0
        public static void UpdatePNPJ(string pnkey, string pn, string pnpj, string defres)
        {
            var sql   = "update PnMainVM set PN=@PN,PNPJ=@PNPJ,DefaultResult=@DefaultResult where PNKey = @PNKey";
            var param = new Dictionary <string, string>();

            param.Add("@PNKey", pnkey);
            param.Add("@PN", pn);
            param.Add("@PNPJ", pnpj);
            param.Add("@DefaultResult", defres);
            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 13
0
        public static void StoreNewPN(string pn, string pnpj, string defres)
        {
            var sql   = "insert into PnMainVM(PNKey,PN,PNPJ,DefaultResult) values(@PNKey,@PN,@PNPJ,@DefaultResult)";
            var param = new Dictionary <string, string>();

            param.Add("@PNKey", GetUniqKey());
            param.Add("@PN", pn);
            param.Add("@PNPJ", pnpj);
            param.Add("@DefaultResult", defres);
            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 14
0
        public static void UpdateSmartLinkLog(string user, string machine, string link)
        {
            var sql  = "insert SmartLinkLog(UserName,Machine,Link,UpdateTime) values(@UserName,@Machine,@Link,@UpdateTime)";
            var dict = new Dictionary <string, string>();

            dict.Add("@UserName", user);
            dict.Add("@Machine", machine);
            dict.Add("@Link", link);
            dict.Add("@UpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            DBUtility.ExeLocalSqlNoRes(sql, dict);
        }
Exemplo n.º 15
0
        public static void RemoveBaseLink(string linkname)
        {
            var sql = "delete from LinkVM where LinkName = '<LinkName>'";

            sql = sql.Replace("<LinkName>", linkname);
            DBUtility.ExeLocalSqlNoRes(sql);

            sql = "delete from MachineLink where LinkName = '<LinkName>'";
            sql = sql.Replace("<LinkName>", linkname);
            DBUtility.ExeLocalSqlNoRes(sql);
        }
Exemplo n.º 16
0
        public static void StoreLink(string linkname, string link, string logo, string comment, string machine)
        {
            var sql = "delete from MachineLink where LinkName = '<LinkName>' and ReqMachine='<ReqMachine>'";

            sql = sql.Replace("<LinkName>", linkname).Replace("<ReqMachine>", machine);
            DBUtility.ExeLocalSqlNoRes(sql);

            sql = "insert into MachineLink(LinkName,Link,Logo,Comment,ReqMachine,Freqence) values(N'<LinkName>',N'<Link>',N'<Logo>',N'<Comment>',N'<ReqMachine>',0)";
            sql = sql.Replace("<LinkName>", linkname).Replace("<Link>", link).Replace("<Logo>", logo)
                  .Replace("<Comment>", comment).Replace("<ReqMachine>", machine);
            DBUtility.ExeLocalSqlNoRes(sql);
        }
Exemplo n.º 17
0
        public static void StoreLink(string linkname, string link, string logo, string comment)
        {
            var sql = "delete from LinkVM where LinkName = N'<LinkName>'";

            sql = sql.Replace("<LinkName>", linkname);
            DBUtility.ExeLocalSqlNoRes(sql);

            sql = "insert into LinkVM(LinkName,Link,Logo,UpdateTime,Comment) values(N'<LinkName>',N'<Link>',N'<Logo>',N'<UpdateTime>',N'<Comment>')";
            sql = sql.Replace("<LinkName>", linkname).Replace("<Link>", link).Replace("<Logo>", logo)
                  .Replace("<UpdateTime>", DateTime.Now.ToString()).Replace("<Comment>", comment);
            DBUtility.ExeLocalSqlNoRes(sql);
        }
Exemplo n.º 18
0
        public static void UpdateNGWafer(List <string> waferlist)
        {
            var sql = "delete from NGWafer";

            DBUtility.ExeLocalSqlNoRes(sql);
            foreach (var item in waferlist)
            {
                sql = "insert into NGWafer(WaferNo) values(N'<WaferNo>')";
                sql = sql.Replace("<WaferNo>", item.Replace("'", "").Trim());
                DBUtility.ExeLocalSqlNoRes(sql);
            }
        }
Exemplo n.º 19
0
        public static void UpdateQueryHistory(string wafer, string x, string y, string machine, string rest)
        {
            var sql  = "update ProbeTestData set APVal7=@machine,APVal8=@rest,APVal9=@updatetime where Wafer=@wafer and X=@x and Y=@y";
            var dict = new Dictionary <string, string>();

            dict.Add("@machine", machine);
            dict.Add("@rest", rest);
            dict.Add("@updatetime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            dict.Add("@wafer", wafer);
            dict.Add("@x", x);
            dict.Add("@y", y);
            DBUtility.ExeLocalSqlNoRes(sql, dict);
        }
Exemplo n.º 20
0
        public static void RemoveFileByID(string id)
        {
            var sql  = "delete from SnapFileVM where DocID=@DocID and ReviewTimes = 0";
            var dict = new Dictionary <string, string>();

            dict.Add("@DocID", id);
            DBUtility.ExeLocalSqlNoRes(sql, dict);

            sql  = "update SnapFileVM set APVal1 = 'DELETE'  where DocID=@DocID ";
            dict = new Dictionary <string, string>();
            dict.Add("@DocID", id);
            DBUtility.ExeLocalSqlNoRes(sql, dict);
        }
Exemplo n.º 21
0
        public static void StoreData(string id, string owner, string shareto, string url, string tag, string now)
        {
            var sql  = "insert into SnapFileVM(DocID,Owner,ShareTo,FileAddr,UpdateTime,APVal2) values(@DocID,@Owner,@ShareTo,@FileAddr,@UpdateTime,@Tag)";
            var dict = new Dictionary <string, string>();

            dict.Add("@DocID", id);
            dict.Add("@Owner", owner);
            dict.Add("@ShareTo", shareto);
            dict.Add("@FileAddr", url);
            dict.Add("@UpdateTime", now);
            dict.Add("@Tag", tag);
            DBUtility.ExeLocalSqlNoRes(sql, dict);
        }
Exemplo n.º 22
0
        public static void StoreVideo(string sub, string des, string path, string uper)
        {
            var sql   = "insert into TechVideoVM(VID,VSubject,VDescription,VPath,UpdateTime,Updater) values(@VID,@VSubject,@VDescription,@VPath,@UpdateTime,@Updater)";
            var param = new Dictionary <string, string>();

            param.Add("@VID", GetUniqKey());
            param.Add("@VSubject", sub);
            param.Add("@VDescription", des);
            param.Add("@VPath", path);
            param.Add("@UpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            param.Add("@Updater", uper);
            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 23
0
        public void StoreData()
        {
            var sql  = "insert into ProbeTestData(Wafer,Famy,X,Y,Bin,ApSize,APVal1) values(@Wafer,@Famy,@X,@Y,@Bin,@ApSize,@APVal1)";
            var dict = new Dictionary <string, string>();

            dict.Add("@Wafer", Wafer);
            dict.Add("@Famy", Famy);
            dict.Add("@X", X);
            dict.Add("@Y", Y);
            dict.Add("@Bin", Bin);
            dict.Add("@ApSize", ApSize);
            dict.Add("@APVal1", APVal1);
            DBUtility.ExeLocalSqlNoRes(sql, dict);
        }
Exemplo n.º 24
0
        public static void TryAddMachineUserMap(string machine, string username)
        {
            var exist = RetrieveUserMap(machine);

            if (exist.Count == 0)
            {
                var tempname = username.Split(new string[] { "@" }, StringSplitOptions.RemoveEmptyEntries)[0].ToUpper().Trim();
                var sql      = "insert into machineusermap(machine,username) values(@machine,@username)";
                var param    = new Dictionary <string, string>();
                param.Add("@machine", machine.ToUpper().Trim());
                param.Add("@username", tempname.ToUpper().Trim());
                DBUtility.ExeLocalSqlNoRes(sql, param);
            }
        }
Exemplo n.º 25
0
        private static void UpdateArrayInfo()
        {
            var wflist = WaferList();

            foreach (var wf in wflist)
            {
                var arraysize = GetWaferArray(wf);
                var sql       = "update ProbeTestData set APVal1 = @APVal1 where Wafer = @Wafer";

                var dict = new Dictionary <string, string>();
                dict.Add("@Wafer", wf);
                dict.Add("@APVal1", arraysize);
                DBUtility.ExeLocalSqlNoRes(sql, dict);
            }
        }
Exemplo n.º 26
0
        public static void StoreNote(string doorcode, string note)
        {
            var notekey  = GetUniqKey();
            var notedate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            var dict     = new Dictionary <string, string>();

            dict.Add("@notekey", notekey);
            dict.Add("@doorcode", doorcode);
            dict.Add("@note", note);
            dict.Add("@notedate", notedate);

            var sql = "insert into SimpleNoteVM(notekey,doorcode,note,notedate) values(@notekey,@doorcode,@note,@notedate)";

            DBUtility.ExeLocalSqlNoRes(sql, dict);
        }
Exemplo n.º 27
0
        public static void RemovePN(string pnkey)
        {
            var param = new Dictionary <string, string>();

            param.Add("@PNKey", pnkey);

            var sql = "delete from PnMainVM where PNKey = @PNKey";

            DBUtility.ExeLocalSqlNoRes(sql, param);

            sql = "delete from PnMESVM where PNKey = @PNKey";
            DBUtility.ExeLocalSqlNoRes(sql, param);

            sql = "delete from PnRulesVM where PnKey = @PNKey";
            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 28
0
        public static void RemoveCustomLink(string linkname, string link, string logo, string comment, string machine)
        {
            var sql = "select Freqence from MachineLink where ReqMachine = '<ReqMachine>' and LinkName = '<LinkName>'";

            sql = sql.Replace("<ReqMachine>", machine).Replace("<LinkName>", linkname);
            var dbret = DBUtility.ExeLocalSqlWithRes(sql);

            if (dbret.Count == 0)
            {
                StoreLink(linkname, link, logo, comment, machine);
            }

            sql = "update MachineLink set Action = N'<Action>'  where ReqMachine = '<ReqMachine>' and LinkName = '<LinkName>'";
            sql = sql.Replace("<ReqMachine>", machine).Replace("<LinkName>", linkname).Replace("<Action>", LINKACTION.DELETE);
            DBUtility.ExeLocalSqlNoRes(sql);
        }
Exemplo n.º 29
0
        public static void AddMachineUserMap(string machine, string username)
        {
            var sql = "delete from machineusermap where machine = '<machine>'";

            sql = sql.Replace("<machine>", machine);
            DBUtility.ExeLocalSqlNoRes(sql);

            var tempname = username.Split(new string[] { "@" }, StringSplitOptions.RemoveEmptyEntries)[0].ToUpper().Trim();

            sql = "insert into machineusermap(machine,username) values(@machine,@username)";
            var param = new Dictionary <string, string>();

            param.Add("@machine", machine.ToUpper().Trim());
            param.Add("@username", tempname.ToUpper().Trim());
            DBUtility.ExeLocalSqlNoRes(sql, param);
        }
Exemplo n.º 30
0
        public static void EditRule(string pnkey, string ruleid, string wt, string err, string para, string low, string high, string ruleres, string tc)
        {
            var sql = "update PnRulesVM set WhichTest=@WhichTest,ErrAbbr=@ErrAbbr,Param=@Param,LowLimit=@LowLimit,HighLimit=@HighLimit,RuleRes= @RuleRes,TestCase= @TestCase where RuleID = @RuleID";
            var pa  = new Dictionary <string, string>();

            pa.Add("@RuleID", ruleid);
            pa.Add("@WhichTest", wt);
            pa.Add("@ErrAbbr", err);
            pa.Add("@Param", para);
            pa.Add("@LowLimit", low);
            pa.Add("@HighLimit", high);
            pa.Add("@RuleRes", ruleres);
            pa.Add("@TestCase", tc);
            DBUtility.ExeLocalSqlNoRes(sql, pa);
            PnMESVM.BindMesTab(pnkey, wt);
        }