public string[] setReturnData1(SearchReturnResult ReturnDataResult) { string[] returnValue = new string[2]; returnValue[0] = "0"; returnValue[1] = "0"; DataBase Base = new DataBase(); using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString())) { try { StaffDataBase sDB = new StaffDataBase(); List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name); Sqlconn.Open(); string sql = "UPDATE PropertyReturn SET ReturnDate=@executionreturnedDate, OutputDate=@executiongetgoodsDate, Quantity=@executionQuantity, "+ "Reason=@executionReason, UpFileBy=@UpFileBy, UpFileDate=(getDate()) WHERE ID=@rID AND isDeleted=0"; SqlCommand cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@rID", SqlDbType.BigInt).Value = ReturnDataResult.rID; cmd.Parameters.Add("@executionreturnedDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(ReturnDataResult.executionreturnedDate); cmd.Parameters.Add("@executiongetgoodsDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(ReturnDataResult.executiongetgoodsDate); cmd.Parameters.Add("@executionQuantity", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(ReturnDataResult.executionQuantity); cmd.Parameters.Add("@executionReason", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(ReturnDataResult.executionReason); cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]); returnValue[0] = cmd.ExecuteNonQuery().ToString(); Sqlconn.Close(); } catch (Exception e) { returnValue[0] = "-1"; returnValue[1] = e.Message.ToString(); } } return returnValue; }
public string[] setReturnData1(SearchReturnResult ReturnDataResult) { OtherDataBase sDB = new OtherDataBase(); if (int.Parse(sDB._StaffhaveRoles[1]) == 1) { return sDB.setReturnData1(ReturnDataResult); } else { return new string[2] { _noRole, _errorMsg }; } }